Win32OperatingSystem.st
author Stefan Vogel <sv@exept.de>
Fri, 12 Aug 2016 17:44:15 +0200
changeset 20246 dacb56e06db1
parent 20245 0ea9c9caba33
child 20248 34ed3b6c7307
child 20275 e3c9c5a28f9c
permissions -rw-r--r--
#OTHER by stefan class: Win32OperatingSystem changed: #userInfoOf:
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;
19668
8c30d204cd7b bcc fix
Claus Gittinger <cg@exept.de>
parents: 19666
diff changeset
   735
    lTime += (LONGLONG)11644473600000L;  // rebias to 1.1.1601
19653
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
20174
d3f07efc7045 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20063
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:[
20062
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4271
        nullStream := Filename nullDevice readWriteStream.
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
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:[
20062
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4275
        nullStream isNil ifTrue:[nullStream := Filename nullDevice writeStream].
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
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:[
20062
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
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
20062
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4283
        exec:(shellAndArgs at:1)
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4284
        withArguments:(shellAndArgs at:2)
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4285
        environment:anEvironmentDictionary
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4286
        fileDescriptors:(Array with:in fileHandle
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4287
                               with:out fileHandle
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4288
                               with:err fileHandle
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4289
                               with:(anAuxiliaryStream notNil ifTrue:[anAuxiliaryStream fileHandle] ifFalse:[nil]))
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4290
        fork:true
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4291
        newPgrp:true
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
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:[
20062
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
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:[
20062
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
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
20062
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4330
    "
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4331
     |pid sema|
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4332
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4333
     sema := Semaphore new.
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4334
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4335
     Processor 
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4336
            monitor:[
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4337
                pid := OperatingSystem startProcess:'dir > out 2>err'
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4338
            ]
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4339
            action:[:osStatus | sema signal ].
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4340
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4341
     sema wait.
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4342
     Transcript showCR:'finished'
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4343
    "
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4344
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4345
"<<END
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4346
     |pid sema|
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4347
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4348
     sema := Semaphore new.
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4349
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4350
     Processor 
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4351
            monitor:[
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4352
                pid := OperatingSystem startProcess:'(echo 1 & stx --eval "Delay waitForSeconds:100" & dir) >out' withCRs
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4353
            ]
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4354
            action:[:osStatus | sema signal ].
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4355
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4356
     Delay waitForSeconds:5.
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4357
     OperatingSystem terminateProcessGroup:pid.
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4358
     Transcript showCR:'terminated'
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4359
END"
2a4ff21c1002 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20056
diff changeset
  4360
20063
69a408ead463 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20062
diff changeset
  4361
"<<END
69a408ead463 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20062
diff changeset
  4362
     |pid sema|
69a408ead463 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20062
diff changeset
  4363
69a408ead463 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20062
diff changeset
  4364
     sema := Semaphore new.
69a408ead463 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20062
diff changeset
  4365
69a408ead463 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20062
diff changeset
  4366
     Processor 
69a408ead463 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20062
diff changeset
  4367
            monitor:[
69a408ead463 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20062
diff changeset
  4368
                pid := OperatingSystem startProcess:{ 'C:\Users\cg\work\stx\projects\smalltalk\stx.com' . '--eval' . '"Delay waitForSeconds:100"' }
69a408ead463 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20062
diff changeset
  4369
            ]
69a408ead463 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20062
diff changeset
  4370
            action:[:osStatus | sema signal ].
69a408ead463 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20062
diff changeset
  4371
69a408ead463 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20062
diff changeset
  4372
     Delay waitForSeconds:5.
69a408ead463 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20062
diff changeset
  4373
     OperatingSystem terminateProcess:pid.
69a408ead463 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20062
diff changeset
  4374
     Transcript showCR:'terminated'
69a408ead463 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20062
diff changeset
  4375
END"
69a408ead463 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20062
diff changeset
  4376
8349
b87b90e6d15a com-command generation (d-quotes in command-arg string)
Claus Gittinger <cg@exept.de>
parents: 8348
diff changeset
  4377
    "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
  4378
    "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
  4379
    "Created: / 12-11-1998 / 14:39:20 / cg"
20063
69a408ead463 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20062
diff changeset
  4380
    "Modified: / 30-06-2016 / 17:43:46 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4381
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4382
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4383
!Win32OperatingSystem class methodsFor:'file access'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4384
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  4385
closeFd:anIntegerOrHandle
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4386
    "low level close of a filedescriptor"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4387
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4388
%{
12686
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  4389
    if (__isSmallInteger(anIntegerOrHandle)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4390
	close(__intVal(anIntegerOrHandle));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4391
	RETURN(self);
12686
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  4392
    }
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  4393
    if (__isExternalAddressLike(anIntegerOrHandle)) {
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  4394
       if (!CloseHandle( __externalAddressVal(anIntegerOrHandle))) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4395
	   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
  4396
       }
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  4397
       RETURN(self);
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  4398
    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4399
%}.
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  4400
    ^ self primitiveFailed.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4401
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4402
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4403
createDirectory:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4404
    "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
  4405
     path, or relative to the current directory.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4406
     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
  4407
     This is a low-level entry - use Filename protocol for compatibility."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4408
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4409
    "/ if it already exists this is ok
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
    (self isDirectory:aPathName) ifTrue:[^ true].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4412
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4413
%{
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4414
    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
  4415
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4416
    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
  4417
    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
  4418
    // 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
  4419
    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
  4420
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  4421
    if (__isStringLike(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4422
	int ret;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4423
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4424
	ret = CreateDirectoryA(__stringVal(aPathName), &sa);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4425
	if (ret != TRUE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4426
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4427
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4428
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4429
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4430
	RETURN (true);
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4431
    }
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4432
    if (__isUnicode16String(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4433
	int ret;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4434
	wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4435
	int i, l;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4436
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4437
	l = __unicode16StringSize(aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4438
	if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4439
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4440
	    _wPathName[i] = __unicode16StringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4441
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4442
	_wPathName[i] = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4443
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4444
	ret = CreateDirectoryW(_wPathName, &sa);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4445
	if (ret != TRUE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4446
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4447
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4448
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4449
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4450
	RETURN (true);
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4451
    }
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4452
%}.
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4453
    ^ self primitiveFailed
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4454
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4455
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4456
     OperatingSystem createDirectory:'foo'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4457
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4458
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4459
    "Modified: 20.12.1995 / 11:24:13 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4460
    "Modified: 29.6.1996 / 14:06:54 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4461
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4462
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4463
createFileForReadAppend:pathName
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4464
     ^ self openFile:pathName attributes:#(#'GENERIC_READ' #'GENERIC_WRITE')
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4465
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4466
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4467
createFileForReadWrite:pathName
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  4468
     ^ self openFile:pathName attributes:#(#'GENERIC_READ' #'GENERIC_WRITE' #'CREATE_ALWAYS')
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4469
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4470
13224
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4471
createHardLinkFrom:oldPath to:newPath
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4472
    "link the file 'oldPath' to 'newPath'. The link will be a hard link.
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4473
     Return true if successful, false if not."
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4474
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4475
    self executeCommand:('mklink/h "%1" "%2"' bindWith:newPath with:oldPath)
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4476
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4477
    "Created: / 19-01-2011 / 08:42:11 / cg"
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4478
!
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4479
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4480
createSymbolicLinkFrom:oldPath to:newPath
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4481
    "make a link from the file 'oldPath' to the file 'newPath'.
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4482
     The link will be a soft (symbolic) link.
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4483
     Return true if successful, false if not."
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4484
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4485
    self executeCommand:('mklink "%1" "%2"' bindWith:newPath with:oldPath)
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4486
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4487
    "Created: / 19-01-2011 / 08:41:44 / cg"
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4488
!
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4489
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4490
getLastError
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4491
%{
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4492
    RETURN ( __mkSmallInteger( __WIN32_ERR(GetLastError()) ));
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4493
%}.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4494
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4495
    "Created: / 31-07-2006 / 12:40:39 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4496
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4497
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4498
getLinkTarget:aPathName
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4499
    "given a filename, which represents a link-file (.lnk),
10161
fd6b02ffb383 avoid recursion
Claus Gittinger <cg@exept.de>
parents: 10160
diff changeset
  4500
     return its resolved path, or nil"
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4501
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4502
    |resolvedPath|
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4503
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4504
%{  /* STACK:100000 */
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4505
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4506
    static IShellLink   * ipShellLink   = NULL;
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4507
    static IPersistFile * ipPersistFile = NULL;
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4508
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4509
    HRESULT hres;
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4510
    WIN32_FIND_DATA wfd;
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  4511
    WORD wsz[MAXPATHLEN];
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  4512
    char szGotPath[MAXPATHLEN];
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  4513
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  4514
    if (! __isStringLike(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4515
	console_fprintf(stderr, "OperatingSystem [info]: invalid argument\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4516
	goto error;
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4517
    }
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4518
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4519
    if( ! coInitialized ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4520
	console_fprintf(stderr, "OperatingSystem [info]: com not initialized\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4521
	goto error;
11193
a432bfa95db0 CoInitialize -> coInitializeEx(MULTITHREADED)
Claus Gittinger <cg@exept.de>
parents: 11135
diff changeset
  4522
    }
a432bfa95db0 CoInitialize -> coInitializeEx(MULTITHREADED)
Claus Gittinger <cg@exept.de>
parents: 11135
diff changeset
  4523
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4524
    if ( ipShellLink == NULL ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4525
	hres = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4526
				&IID_IShellLink, (LPVOID *)&ipShellLink);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4527
	if (! SUCCEEDED(hres)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4528
	    console_fprintf(stderr, "OperatingSystem [info]: CoCreateInstance Error - hres = %08x\n", hres);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4529
	    ipShellLink = NULL;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4530
	    goto error;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4531
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4532
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4533
	hres = ipShellLink->lpVtbl->QueryInterface( ipShellLink, &IID_IPersistFile, (void **)&ipPersistFile );
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4534
	if (! SUCCEEDED(hres)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4535
	    console_fprintf(stderr, "OperatingSystem [info]: QueryInterface Error - hres = %08x\n", hres);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4536
	    ipShellLink->lpVtbl->Release(ipShellLink);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4537
	    ipShellLink   = NULL;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4538
	    ipPersistFile = NULL;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4539
	    goto error;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4540
	}
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4541
    }
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4542
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  4543
    MultiByteToWideChar(CP_ACP, 0, __stringVal(aPathName), -1, wsz, MAXPATHLEN);
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4544
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4545
    hres = ipPersistFile->lpVtbl->Load(ipPersistFile, wsz, STGM_READ);
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4546
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4547
    if (SUCCEEDED(hres)) {
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  4548
	hres = ipShellLink->lpVtbl->GetPath(ipShellLink, szGotPath, MAXPATHLEN,
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4549
		    (WIN32_FIND_DATA *)&wfd, 0 /* SLGP_SHORTPATH */ );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4550
	if (SUCCEEDED(hres)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4551
	    resolvedPath = __MKSTRING(szGotPath);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4552
	} else {
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4553
#ifdef COM_DEBUG
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4554
	    console_fprintf(stderr, "OperatingSystem [info]: GetPath failed - hres = %08x\n", hres );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4555
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4556
	}
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4557
    } else {
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4558
#ifdef COM_DEBUG
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4559
	console_fprintf(stderr, "OperatingSystem [info]: Load failed - hres = %08x\n", hres );
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4560
#endif
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4561
    }
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4562
    /* ipPersistFile->lpVtbl->Release(ipPersistFile);  */
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4563
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4564
error: ;
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4565
%}.
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4566
    resolvedPath notNil ifTrue:[^ resolvedPath ].
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4567
10373
92efacf8b050 getLinkTarget is now done lazyly.
Claus Gittinger <cg@exept.de>
parents: 10365
diff changeset
  4568
    "/ self primitiveFailed.
92efacf8b050 getLinkTarget is now done lazyly.
Claus Gittinger <cg@exept.de>
parents: 10365
diff changeset
  4569
    ^ nil.
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4570
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4571
    "
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4572
     OperatingSystem getLinkTarget:'C:\Dokumente und Einstellungen\cg\Favoriten\Incoming.lnk'
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4573
     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
  4574
    "
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4575
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4576
    "Created: / 07-11-2006 / 10:52:44 / cg"
10373
92efacf8b050 getLinkTarget is now done lazyly.
Claus Gittinger <cg@exept.de>
parents: 10365
diff changeset
  4577
    "Modified: / 07-02-2007 / 10:37:48 / cg"
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4578
!
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4579
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4580
linkFile:oldPath to:newPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4581
    "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
  4582
     Return true if successful, false if not."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4583
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4584
    (oldPath isString not or:[newPath isString not]) ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4585
	"/
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4586
	"/ bad argument(s) given
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4587
	"/
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4588
	^ self primitiveFailed
13224
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4589
    ].
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4590
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4591
    ^ self createHardLinkFrom:oldPath to:newPath
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4592
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4593
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4594
     OperatingSystem linkFile:'foo' to:'bar'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4595
    "
13224
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4596
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4597
    "Modified: / 19-01-2011 / 08:42:53 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4598
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4599
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4600
openFile:pathName attributes:attributeSpec
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4601
    "non public internal helper.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4602
     open a file, return an os specific fileHandle.
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4603
     attributes is a collection of symbols specifying how the file is
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4604
     to be opened."
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4605
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  4606
    |fileHandle errorNumber argumentError|
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4607
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4608
    fileHandle := Win32Handle new.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4609
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4610
%{
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4611
    HANDLE h;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4612
    char *name;
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4613
    wchar_t _wPathName[MAXPATHLEN+1];
11810
24927b757d9b Fix for bad arguments
Stefan Vogel <sv@exept.de>
parents: 11804
diff changeset
  4614
    OBJ *ap;
24927b757d9b Fix for bad arguments
Stefan Vogel <sv@exept.de>
parents: 11804
diff changeset
  4615
    int numAttrib;
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4616
    int i, l;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4617
    DWORD access, share, create, attr;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4618
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  4619
    if (__isStringLike(pathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4620
	name = __stringVal(pathName);
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4621
    } else if (__isUnicode16String(pathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4622
	l = __unicode16StringSize(pathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4623
	if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4624
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4625
	    _wPathName[i] = __unicode16StringVal(pathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4626
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4627
	_wPathName[i] = 0;
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4628
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4629
	fileHandle = nil;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4630
	argumentError = @symbol(badPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4631
	goto badArgument;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4632
    }
11810
24927b757d9b Fix for bad arguments
Stefan Vogel <sv@exept.de>
parents: 11804
diff changeset
  4633
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8912
diff changeset
  4634
    if (! __isArrayLike(attributeSpec)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4635
	fileHandle = nil;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4636
	argumentError = @symbol(badAttributeSpec);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4637
	goto badArgument;
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4638
    }
11810
24927b757d9b Fix for bad arguments
Stefan Vogel <sv@exept.de>
parents: 11804
diff changeset
  4639
    ap = __ArrayInstPtr(attributeSpec)->a_element;
24927b757d9b Fix for bad arguments
Stefan Vogel <sv@exept.de>
parents: 11804
diff changeset
  4640
    numAttrib = __arraySize(attributeSpec);
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4641
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4642
    share = 0;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4643
    access = 0;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4644
    create = 0;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4645
    attr = 0;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4646
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4647
    for (i=0; i<numAttrib;i++) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4648
	OBJ attrSym = ap[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4649
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4650
	if (attrSym == @symbol(FILE_SHARE_READ)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4651
	    share |= FILE_SHARE_READ;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4652
	} else if (attrSym == @symbol(FILE_SHARE_WRITE)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4653
	    share |= FILE_SHARE_WRITE;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4654
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4655
	} else if (attrSym == @symbol(GENERIC_READ)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4656
	    access |= GENERIC_READ;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4657
	} else if (attrSym == @symbol(GENERIC_WRITE)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4658
	    access |= GENERIC_WRITE;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4659
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4660
	} else if (attrSym == @symbol(CREATE_NEW)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4661
	    create |= CREATE_NEW;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4662
	} else if (attrSym == @symbol(CREATE_ALWAYS)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4663
	    create |= CREATE_ALWAYS;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4664
	} else if (attrSym == @symbol(OPEN_EXISTING)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4665
	    create |= OPEN_EXISTING;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4666
	} else if (attrSym == @symbol(OPEN_ALWAYS)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4667
	    create |= OPEN_ALWAYS;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4668
	} else if (attrSym == @symbol(TRUNCATE_EXISTING)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4669
	    create |= TRUNCATE_EXISTING;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4670
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4671
	} else if (attrSym == @symbol(FILE_ATTRIBUTE_HIDDEN)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4672
	    attr |= FILE_ATTRIBUTE_HIDDEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4673
	} else if (attrSym == @symbol(FILE_ATTRIBUTE_READONLY)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4674
	    attr |= FILE_ATTRIBUTE_READONLY;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4675
	} else if (attrSym == @symbol(FILE_ATTRIBUTE_READONLY)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4676
	    attr |= FILE_ATTRIBUTE_READONLY;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4677
	} else if (attrSym == @symbol(FILE_FLAG_WRITE_THROUGH)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4678
	    attr |= FILE_FLAG_WRITE_THROUGH;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4679
	} else if (attrSym == @symbol(FILE_FLAG_SEQUENTIAL_SCAN)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4680
	    attr |= FILE_FLAG_SEQUENTIAL_SCAN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4681
	} else if (attrSym == @symbol(FILE_FLAG_DELETE_ON_CLOSE)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4682
	    attr |= FILE_FLAG_DELETE_ON_CLOSE;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4683
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4684
	    console_fprintf(stderr, "Win32OS [warning]: unsupported open mode\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4685
	}
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4686
    }
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  4687
    if (create == 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4688
	fileHandle = nil;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4689
	argumentError = @symbol(missingCreateMode);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4690
	goto badArgument;
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  4691
    }
8792
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  4692
#ifdef PROCESSDEBUGWIN32
10352
f2e9bb8906db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10342
diff changeset
  4693
    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
  4694
		name, access, share, create, attr);
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4695
#endif
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  4696
    if (__isStringLike(pathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4697
	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
  4698
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4699
	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
  4700
    }
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4701
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4702
    if (h != INVALID_HANDLE_VALUE) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4703
	__externalAddressVal(fileHandle) = (void *)h;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4704
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4705
	fileHandle = nil;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4706
	errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4707
    }
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4708
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4709
badArgument: ;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4710
%}.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4711
    fileHandle notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4712
	fileHandle registerForFinalization.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4713
	^ fileHandle.
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4714
    ].
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4715
    errorNumber isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4716
	self error:'invalid argument(s): ', argumentError.
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4717
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4718
	(self errorHolderForNumber:errorNumber) reportError
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4719
    ].
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4720
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4721
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4722
openFileForAppend:pathName
8412
cb1f92123250 Fix getting home directory if it is on a network share.
Stefan Vogel <sv@exept.de>
parents: 8360
diff changeset
  4723
    "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
  4724
cb1f92123250 Fix getting home directory if it is on a network share.
Stefan Vogel <sv@exept.de>
parents: 8360
diff changeset
  4725
    ^ self shouldImplement
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4726
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4727
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4728
openFileForRead:pathName
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  4729
     ^ self openFile:pathName attributes:#(#'GENERIC_READ' #'OPEN_EXISTING')
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4730
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4731
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4732
openFileForReadAppend:pathName
8412
cb1f92123250 Fix getting home directory if it is on a network share.
Stefan Vogel <sv@exept.de>
parents: 8360
diff changeset
  4733
    "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
  4734
cb1f92123250 Fix getting home directory if it is on a network share.
Stefan Vogel <sv@exept.de>
parents: 8360
diff changeset
  4735
    ^ self shouldImplement
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4736
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4737
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4738
openFileForReadWrite:pathName
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4739
     ^ self openFile:pathName attributes:#(#'GENERIC_READ' #'GENERIC_WRITE')
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4740
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4741
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4742
openFileForWrite:pathName
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  4743
     ^ self openFile:pathName attributes:#(#'GENERIC_WRITE' #'OPEN_EXISTING')
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4744
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4745
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4746
recursiveCopyDirectory:sourcePathName to:destination
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4747
    "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
  4748
     Return true if successful."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4749
18979
b07c5e5e2782 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18964
diff changeset
  4750
    ^ 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
  4751
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4752
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4753
removeDirectory:fullPathName
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4754
    "remove the directory named 'fullPathName'.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4755
     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
  4756
     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
  4757
     This is a lowLevel entry - use Filename protocol for compatibility."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4758
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4759
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4760
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4761
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  4762
    if (__isStringLike(fullPathName)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4763
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4764
	{
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4765
	    char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4766
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4767
	    strncpy(_aPathName, __stringVal(fullPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4768
	    do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4769
		__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
  4770
		// 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
  4771
		ret = (int)(STX_API_NOINT_CALL1( "RemoveDirectoryA", RemoveDirectoryA, _aPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4772
	    } while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4773
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4774
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4775
	ret = RemoveDirectoryA((char *)__stringVal(fullPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4776
	__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4777
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4778
	if (ret != TRUE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4779
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4780
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4781
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4782
	RETURN (true);
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4783
    }
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4784
    if (__isUnicode16String(fullPathName)) {
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4785
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4786
	{
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4787
	    wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4788
	    int i, l;
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
	    l = __unicode16StringSize(fullPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4791
	    if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4792
	    for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4793
		_wPathName[i] = __unicode16StringVal(fullPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4794
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4795
	    _wPathName[i] = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4796
	    do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4797
		__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
  4798
		// 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
  4799
		ret = (int)(STX_API_NOINT_CALL1( "RemoveDirectoryW", RemoveDirectoryW, _wPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4800
	    } while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4801
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4802
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4803
	ret = RemoveDirectoryW((char *)__stringVal(fullPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4804
	__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4805
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4806
	if (ret != TRUE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4807
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4808
	    RETURN (false);
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
	RETURN (true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4811
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4812
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4813
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4814
    "/ either not a string argument,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4815
    "/ or not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4816
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4817
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4818
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4819
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4820
     OperatingSystem createDirectory:'foo'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4821
     OperatingSystem removeDirectory:'foo'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4822
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4823
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4824
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4825
removeFile:fullPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4826
    "remove the file named 'fullPathName'; return true if successful.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4827
     This is a lowLevel entry - use Filename protocol for compatibility."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4828
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4829
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4830
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4831
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  4832
    if (__isStringLike(fullPathName)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4833
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4834
	{
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4835
	    char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4836
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4837
	    strncpy(_aPathName, __stringVal(fullPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4838
	    do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4839
		__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
  4840
		// 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
  4841
		ret = (int)(STX_API_NOINT_CALL1( "DeleteFileA", DeleteFileA, _aPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4842
	    } while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4843
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4844
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4845
	ret = DeleteFileA((char *)__stringVal(fullPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4846
	__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4847
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4848
	if (ret != TRUE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4849
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4850
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4851
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4852
	RETURN (true);
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4853
    }
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4854
    if (__isUnicode16String(fullPathName)) {
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4855
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4856
	{
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4857
	    wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4858
	    int i, l;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4859
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4860
	    l = __unicode16StringSize(fullPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4861
	    if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4862
	    for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4863
		_wPathName[i] = __unicode16StringVal(fullPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4864
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4865
	    _wPathName[i] = 0;
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;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4868
		// 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
  4869
		ret = (int)(STX_API_NOINT_CALL1( "DeleteFileW", DeleteFileW, _wPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4870
	    } while ((ret < 0) && (__threadErrno == EINTR));
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
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4873
	ret = DeleteFileW((char *)__stringVal(fullPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4874
	__threadErrno = __WIN32_ERR(GetLastError());
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 != TRUE) {
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);
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4881
    }
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4882
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4883
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4884
    ^ self primitiveFailed
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4887
renameFile:oldPath to:newPath
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4888
    "rename the file 'oldPath' to 'newPath'.
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4889
     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
  4890
     correct for the OS used - therefore, this should not be called
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4891
     directlt. Instead, use Filename protocol to rename; this cares for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4892
     any invalid names.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4893
     Returns true if successful, false if not"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4894
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4895
%{
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4896
    int ret;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4897
    int eno;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4898
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  4899
    if (__isStringLike(oldPath) && __isStringLike(newPath)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4900
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4901
	char _oldPath[MAXPATHLEN], _newPath[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4902
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4903
	strncpy(_oldPath, __stringVal(oldPath), MAXPATHLEN-1); _oldPath[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4904
	strncpy(_newPath, __stringVal(newPath), MAXPATHLEN-1); _newPath[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4905
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4906
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4907
	    __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
  4908
	    // do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4909
	    ret = STX_C_NOINT_CALL2( "rename", rename, _oldPath, _newPath);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4910
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4911
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4912
	__BEGIN_INTERRUPTABLE__
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4913
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4914
	    __threadErrno = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4915
	    ret = rename((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4916
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4917
	__END_INTERRUPTABLE__
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4918
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4919
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4920
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4921
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4922
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4923
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4924
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4925
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4926
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4927
	RETURN (true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4928
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4929
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4930
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4931
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4932
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4933
     OperatingSystem renameFile:'foo' to:'bar'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4934
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4935
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4936
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4937
truncateFile:aPathName to:newSize
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4938
    "change a files size return true on success, false on failure.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4939
     This may not be supported on all architectures.
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
     This is a low-level entry - use Filename protocol."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4942
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4943
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4944
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4945
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4946
!Win32OperatingSystem class methodsFor:'file access rights'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4947
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4948
accessMaskFor:aSymbol
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4949
    "return the access bits mask for numbers as returned by
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4950
     OperatingSystem>>accessModeOf:
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4951
     and expected by OperatingSystem>>changeAccessModeOf:to:.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4952
     Since these numbers are OS dependent, always use the mask
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4953
     (never hardcode 8rxxx into your code)."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4954
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4955
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4956
    /* posix systems should define these ... */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4957
#   ifndef S_IRUSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4958
#    define S_IRUSR 0400
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4959
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4960
#   ifndef S_IWUSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4961
#    define S_IWUSR 0200
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4962
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4963
#   ifndef S_IXUSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4964
#    define S_IXUSR 0100
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4965
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4966
#   ifndef S_IRGRP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4967
#    define S_IRGRP 0040
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4968
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4969
#   ifndef S_IWGRP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4970
#    define S_IWGRP 0020
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4971
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4972
#   ifndef S_IXGRP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4973
#    define S_IXGRP 0010
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4974
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4975
#   ifndef S_IROTH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4976
#    define S_IROTH 0004
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4977
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4978
#   ifndef S_IWOTH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4979
#    define S_IWOTH 0002
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4980
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4981
#   ifndef S_IXOTH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4982
#    define S_IXOTH 0001
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4983
#   endif
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
    if (aSymbol == @symbol(readUser)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4986
	RETURN ( __mkSmallInteger(S_IRUSR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4987
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4988
    if (aSymbol == @symbol(writeUser)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4989
	RETURN ( __mkSmallInteger(S_IWUSR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4990
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4991
    if (aSymbol == @symbol(executeUser)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4992
	RETURN ( __mkSmallInteger(S_IXUSR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4993
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4994
    if (aSymbol == @symbol(readGroup)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4995
	RETURN ( __mkSmallInteger(S_IRGRP) );
5133
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
    if (aSymbol == @symbol(writeGroup)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4998
	RETURN ( __mkSmallInteger(S_IWGRP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4999
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5000
    if (aSymbol == @symbol(executeGroup)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5001
	RETURN ( __mkSmallInteger(S_IXGRP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5002
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5003
    if (aSymbol == @symbol(readOthers)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5004
	RETURN ( __mkSmallInteger(S_IROTH) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5005
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5006
    if (aSymbol == @symbol(writeOthers)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5007
	RETURN ( __mkSmallInteger(S_IWOTH) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5008
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5009
    if (aSymbol == @symbol(executeOthers)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5010
	RETURN ( __mkSmallInteger(S_IXOTH) );
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  5011
    }
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  5012
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  5013
    // 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
  5014
    // (but handle them for UNIX compatibility
1b41c869040a More file access mode definitions
Stefan Vogel <sv@exept.de>
parents: 10627
diff changeset
  5015
    if (aSymbol == @symbol(setUid)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5016
	RETURN ( __mkSmallInteger(0) );
10664
1b41c869040a More file access mode definitions
Stefan Vogel <sv@exept.de>
parents: 10627
diff changeset
  5017
    }
1b41c869040a More file access mode definitions
Stefan Vogel <sv@exept.de>
parents: 10627
diff changeset
  5018
    if (aSymbol == @symbol(setGid)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5019
	RETURN ( __mkSmallInteger(0) );
10664
1b41c869040a More file access mode definitions
Stefan Vogel <sv@exept.de>
parents: 10627
diff changeset
  5020
    }
1b41c869040a More file access mode definitions
Stefan Vogel <sv@exept.de>
parents: 10627
diff changeset
  5021
    if (aSymbol == @symbol(removeOnlyByOwner)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5022
	RETURN ( __mkSmallInteger(0) );
10664
1b41c869040a More file access mode definitions
Stefan Vogel <sv@exept.de>
parents: 10627
diff changeset
  5023
    }
1b41c869040a More file access mode definitions
Stefan Vogel <sv@exept.de>
parents: 10627
diff changeset
  5024
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5025
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5026
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5027
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5028
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5029
     OperatingSystem accessMaskFor:#readUser
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5033
accessModeOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5034
    "return a number representing access rights rwxrwxrwx for owner,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5035
     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
  5036
     Notice that the returned number is OS dependent - use the
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5037
     modeMasks as returned by OperatingSystem>>accessMaskFor:"
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
     this could have been implemented as:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5041
	(self infoOf:aPathName) at:#mode
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5042
     but for huge directory searches the code below is faster
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5043
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5044
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5045
%{
10449
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  5046
    struct stat buf;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5047
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5048
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5049
    if (__isStringLike(aPathName)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5050
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5051
	char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5052
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5053
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5054
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5055
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5056
	    __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
  5057
	    // do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5058
	    ret = STX_C_NOINT_CALL2( "stat", stat, _aPathName, &buf);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5059
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5060
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5061
	__BEGIN_INTERRUPTABLE__
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5062
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5063
	    __threadErrno = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5064
	    ret = stat( (char *)__stringVal(aPathName), &buf);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5065
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5066
	__END_INTERRUPTABLE__
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5067
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5068
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5069
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5070
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5071
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5072
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5073
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5074
	    RETURN ( nil );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5075
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5076
	RETURN ( __mkSmallInteger(buf.st_mode & 0777) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5077
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5078
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5079
   ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5080
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5081
   "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5082
    (OperatingSystem accessModeOf:'/') printStringRadix:8
10449
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  5083
    (OperatingSystem accessModeOf:'Make.proto') printStringRadix:8
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  5084
    (OperatingSystem changeAccessModeOf:'Make.proto' to:8r644)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5085
   "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5086
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5087
15500
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5088
accessModeOfFd:aFileDescriptor
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5089
    "return a number representing access rights rwxrwxrwx for owner,
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5090
     group and others. Return nil if such a file does not exist.
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5091
     Notice that the returned number is OS dependent - use the
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5092
     modeMasks as returned by OperatingSystem>>accessMaskFor:"
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5093
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
     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
  5096
	(self infoOf:aPathName) at:#mode
15500
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5097
     but for huge directory searches the code below is faster
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5098
    "
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5099
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5100
%{
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5101
    struct stat buf;
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5102
    int ret;
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5103
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5104
    if (__isSmallInteger(aFileDescriptor)) {
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5105
#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
  5106
	do {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5107
	    __threadErrno = 0;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5108
	    // 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
  5109
	    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
  5110
	} 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
  5111
#else
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5112
	__BEGIN_INTERRUPTABLE__
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5113
	do {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5114
	    __threadErrno = 0;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5115
	    // 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
  5116
	    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
  5117
	} 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
  5118
	__END_INTERRUPTABLE__
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5119
	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
  5120
	    __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
  5121
	}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5122
#endif
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5123
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5124
	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
  5125
	    @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
  5126
	    RETURN ( nil );
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5127
	}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5128
	RETURN ( __mkSmallInteger(buf.st_mode & 0777) );
15500
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5129
    }
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5130
%}.
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5131
   ^ self primitiveFailed
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5132
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5133
   "
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5134
    '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
  5135
	(OperatingSystem accessModeOfFd:s fileDescriptor) printStringRadix:8.
15500
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5136
    ].
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5137
    '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
  5138
	(OperatingSystem accessModeOfFd:s fileDescriptor) printStringRadix:8.
15500
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5139
    ].
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5140
    (OperatingSystem changeAccessModeOf:'Make.proto' to:8r644)
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5141
   "
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5142
!
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  5143
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5144
changeAccessModeOf:aPathName to:modeBits
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5145
    "change the access rights of aPathName to the OS dependent modeBits.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5146
     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
  5147
     independent. Return true if changed,
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5148
     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
  5149
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5150
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5151
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5152
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5153
    if (__isStringLike(aPathName) && __isSmallInteger(modeBits)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5154
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5155
	int chmod();
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5156
	char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5157
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5158
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5159
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5160
	    __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
  5161
	    // do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5162
	    ret = STX_C_NOINT_CALL2( "chmod", chmod, _aPathName, __intVal(modeBits));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5163
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5164
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5165
	__BEGIN_INTERRUPTABLE__
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5166
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5167
	    __threadErrno = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5168
	    ret = chmod((char *)__stringVal(aPathName), __intVal(modeBits));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5169
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5170
	__END_INTERRUPTABLE__
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5171
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5172
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5173
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5174
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5175
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5176
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5177
	    RETURN ( false );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5178
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5179
	RETURN ( true );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5180
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5181
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5182
    ^ self primitiveFailed
10449
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  5183
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  5184
   "
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  5185
    (OperatingSystem accessModeOf:'Make.proto') printStringRadix:8
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  5186
    (OperatingSystem changeAccessModeOf:'Make.proto' to:8r644)
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  5187
   "
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5188
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5189
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5190
!Win32OperatingSystem class methodsFor:'file dialogs'!
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5191
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5192
commDlgExtendedError
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5193
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5194
    <apicall: ulong "CommDlgExtendedError" () module: "comdlg32.dll" >
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5195
    ^self primitiveFailed
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5196
!
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5197
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5198
getOpenFilename: openFilenameStructureExternalAddress
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5199
    "Opens a windows native file dialog without blocking stx
19416
90a164f523de #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19369
diff changeset
  5200
     for an OpenFilenameStructure stored in an externalStructure"
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5201
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5202
    | rslt |
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5203
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5204
%{  /* STACK: 32000*/
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5205
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5206
    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
  5207
    int __rslt;
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5208
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5209
    if (__isExternalAddressLike(openFilenameStructureExternalAddress)
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  5210
     || __isExternalBytesLike(openFilenameStructureExternalAddress)){
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5211
	__address = __externalAddressVal(openFilenameStructureExternalAddress);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5212
	__rslt = __STX_API_CALL1( "GetOpenFileNameA", (void *)GetOpenFileNameA, __address);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5213
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5214
	if (__rslt == TRUE) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5215
	    rslt = true;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5216
	} else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5217
	    rslt = false;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5218
	}
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5219
    }
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5220
%}.
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5221
    rslt isNil ifTrue:[ self primitiveFailed ].
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5222
    ^ rslt
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5223
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5224
    "Modified (format): / 11-02-2014 / 21:18:02 / cg"
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5225
!
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5226
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5227
getSaveFilename: openFilenameStructureExternalAddress
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5228
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5229
    "Opens a windows native file dialog without blocking stx
19416
90a164f523de #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19369
diff changeset
  5230
     for an OpenFilenameStructure stored in an externalStructure."
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5231
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5232
    | rslt |
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5233
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5234
%{  /* STACK: 32000*/
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5235
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5236
    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
  5237
    int __rslt;
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5238
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5239
    if (__isExternalAddressLike(openFilenameStructureExternalAddress)
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  5240
     || __isExternalBytesLike(openFilenameStructureExternalAddress)){
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5241
	__address = __externalAddressVal(openFilenameStructureExternalAddress);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5242
	__rslt = __STX_API_CALL1( "GetSaveFileName", (void *)GetSaveFileName, __address);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5243
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5244
	if (__rslt == TRUE) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5245
	    rslt = true;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5246
	} else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5247
	    rslt = false;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  5248
	}
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5249
    }
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5250
%}.
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5251
    rslt isNil ifTrue:[ self primitiveFailed ].
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5252
    ^ rslt
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5253
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  5254
    "Modified: / 11-02-2014 / 21:18:20 / cg"
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5255
! !
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  5256
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5257
!Win32OperatingSystem class methodsFor:'file queries'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5258
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5259
caseSensitiveFilenames
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5260
    "return true, if the OS has caseSensitive file naming.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5261
     On MSDOS, this will return false;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5262
     on a real OS, we return true."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5263
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5264
    ^ false
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
12969
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5267
clearHidden:aPathName
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5268
    "set the hidden attribute; Return true if the operation succeeded"
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5269
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5270
    |attr|
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5271
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5272
    attr := self primGetFileAttributes:aPathName.
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5273
    (attr bitTest:FILE_ATTRIBUTE_HIDDEN ) ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5274
	^ self primSetFileAttributes:aPathName to:(attr bitClear:2).
12969
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5275
    ].
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5276
    ^ true
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5277
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5278
    "Created: / 29-07-2010 / 11:31:55 / sr"
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5279
!
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  5280
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5281
compressPath:pathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5282
    "return the pathName compressed - that is, remove all ..-entries
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5283
     and . entries. This does not always (in case of symbolic links)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5284
     return the true pathName and is therefore used as a fallback
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5285
     if realPath and popen failed."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5286
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5287
    |names n "{ Class: SmallInteger }" |
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5288
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5289
    names := pathName
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5290
		asCollectionOfSubstringsSeparatedBy:self fileSeparator.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5291
    names := names asOrderedCollection.
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
     cut off initial double-slashes
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5294
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5295
    [names startsWith:#('' '')] whileTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5296
	names removeFirst.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5297
    ].
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
     cut off double-slashes at end
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
    [names endsWith:#('')] whileTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5302
	names removeLast.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5303
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5304
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5305
     cut off current-dir at beginning
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5306
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5307
    n := names size.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5308
    [(n >= 2) and:[names startsWith:#('.')]] whileTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5309
	names removeFirst.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5310
	n := n - 1.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5311
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5312
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5313
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5314
     cut off parent-dirs at end
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5315
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5316
    [(n > 2)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5317
     and:[(names endsWith:#('..'))
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5318
     and:[((names at:(n - 1)) startsWith:'.') not ]]] whileTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5319
	names removeLast; removeLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5320
	n := n - 2.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5321
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5322
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5323
    ^ names asStringWith:self fileSeparator
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5324
		    from:1
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5325
		    to:n
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5326
		    compressTabs:false final:nil
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5327
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5328
    "
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5329
     OperatingSystem compressPath:'.\..'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5330
     OperatingSystem compressPath:'\foo\bar\baz\..'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5331
     OperatingSystem compressPath:'foo\bar\baz\..'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5332
     OperatingSystem compressPath:'foo\bar\baz\..\'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5333
     OperatingSystem compressPath:'foo\bar\baz\..\\\'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5334
     OperatingSystem compressPath:'\\\foo\bar\baz\..\\\'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5335
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5336
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5337
    "Modified: 1.11.1996 / 20:13:48 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5338
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5339
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5340
fileSeparator
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5341
    "return the character used to separate names in a path.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5342
     This character differs for MSDOS and other systems,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5343
     (but those are currently not supported - so this is some
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5344
      preparation for the future)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5345
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5346
    ^ $\
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5347
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5348
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5349
getCurrentDirectory
14731
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5350
    "get the current directory"
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5351
18962
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  5352
%{  /* NOCONTEXT */
14731
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5353
    int ret;
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5354
    wchar_t _aPathName[MAXPATHLEN+1];
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5355
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5356
    ret = GetCurrentDirectoryW(MAXPATHLEN, _aPathName);
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5357
    if (ret == 0) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5358
	__threadErrno = __WIN32_ERR(GetLastError());
18962
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  5359
    }
18964
774cb1e6201e #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18962
diff changeset
  5360
    RETURN(__mkStringOrU16String_maxlen(_aPathName, MAXPATHLEN));
18962
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  5361
%}.
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5362
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5363
    "
11291
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5364
     self getCurrentDirectory
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5365
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5366
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5367
10014
6aba6d5620ad volumeName
Claus Gittinger <cg@exept.de>
parents: 9990
diff changeset
  5368
getDiskInfoOf:volumeNameArg
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5369
    "returns a dictionary filled with any of:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5370
	freeBytes
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5371
	totalBytes
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5372
     and possibly additional (OS-specific) information"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5373
10014
6aba6d5620ad volumeName
Claus Gittinger <cg@exept.de>
parents: 9990
diff changeset
  5374
    |volumeName info ok sectorsPerCluster bytesPerSector freeClusters totalClusters
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5375
     type freeBytesForUsersQuota freeBytes totalBytes |
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5376
10014
6aba6d5620ad volumeName
Claus Gittinger <cg@exept.de>
parents: 9990
diff changeset
  5377
    volumeName := volumeNameArg.
6aba6d5620ad volumeName
Claus Gittinger <cg@exept.de>
parents: 9990
diff changeset
  5378
    (volumeName endsWith:$\) ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5379
	volumeName := volumeName , '\'
10014
6aba6d5620ad volumeName
Claus Gittinger <cg@exept.de>
parents: 9990
diff changeset
  5380
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5381
%{
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  5382
    typedef BOOL (WINAPI *P_GDFSE)(LPCTSTR, PULARGE_INTEGER,
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5383
				   PULARGE_INTEGER, PULARGE_INTEGER);
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5384
    P_GDFSE pGetDiskFreeSpaceEx = NULL;
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5385
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5386
    DWORD __sectorsPerCluster, __bytesPerSector, __freeClusters, __totalClusters;
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5387
    BOOL  fResult = 0;
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5388
    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
  5389
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5390
    if (__isStringLike(volumeName) || __isSymbol(volumeName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5391
	 /*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5392
	  *  Use GetDiskFreeSpaceEx if available; otherwise, use GetDiskFreeSpace.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5393
	  *  Notice that GetDiskFreeSpace does not work correctly under win2k,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5394
	  *  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
  5395
	  */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5396
	pGetDiskFreeSpaceEx = (P_GDFSE)GetProcAddress (
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5397
					    GetModuleHandle ("kernel32.dll"),
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5398
							     "GetDiskFreeSpaceExA");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5399
	if (pGetDiskFreeSpaceEx) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5400
	    fResult = pGetDiskFreeSpaceEx (__stringVal(volumeName),
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5401
				 (PULARGE_INTEGER)&i64FreeBytesForUsersQuota,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5402
				 (PULARGE_INTEGER)&i64TotalBytes,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5403
				 (PULARGE_INTEGER)&i64FreeBytes);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5404
	    if (fResult) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5405
		freeBytesForUsersQuota = __MKUINT64(&i64FreeBytesForUsersQuota);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5406
		totalBytes = __MKUINT64(&i64TotalBytes);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5407
		freeBytes = __MKUINT64(&i64FreeBytes);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5408
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5409
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5410
	fResult = GetDiskFreeSpace(__stringVal(volumeName),
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5411
			     &__sectorsPerCluster,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5412
			     &__bytesPerSector,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5413
			     &__freeClusters,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5414
			     &__totalClusters);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5415
	if (fResult) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5416
	    sectorsPerCluster = __MKUINT(__sectorsPerCluster);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5417
	    bytesPerSector = __MKUINT(__bytesPerSector);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5418
	    freeClusters = __MKUINT(__freeClusters);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5419
	    totalClusters = __MKUINT(__totalClusters);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5420
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5421
	switch (GetDriveType(__stringVal(volumeName))) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5422
	    case DRIVE_REMOVABLE:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5423
		type = @symbol(removable); break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5424
	    case DRIVE_FIXED:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5425
		type = @symbol(fixed); break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5426
	    case DRIVE_REMOTE:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5427
		type = @symbol(network); break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5428
	    case DRIVE_CDROM:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5429
		type = @symbol(cdrom); break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5430
	    case DRIVE_RAMDISK:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5431
		type = @symbol(ramdisk); break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5432
	    case DRIVE_UNKNOWN:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5433
	    default:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5434
		break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5435
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5436
	if (fResult) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5437
	    ok = true;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5438
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5439
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5440
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5441
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5442
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5443
%}.
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5444
    ok == true ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5445
	self primitiveFailed.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5446
	^ self
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5447
    ].
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5448
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5449
    info := IdentityDictionary new.
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5450
    info at:#sectorsPerCluster put:sectorsPerCluster.
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5451
    info at:#bytesPerSector put:bytesPerSector.
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5452
    info at:#freeClusters put:freeClusters.
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5453
    info at:#totalClusters put:totalClusters.
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5454
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  5455
    info at:#freeBytes put:(freeBytes notNil
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5456
				ifTrue:[freeBytes]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5457
				ifFalse:[freeClusters * sectorsPerCluster * bytesPerSector]).
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5458
    info at:#totalBytes put:(totalBytes notNil
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5459
				ifTrue:[totalBytes]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5460
				ifFalse:[totalClusters * sectorsPerCluster * bytesPerSector]).
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5461
    info at:#freeBytesForUsersQuota put:freeBytesForUsersQuota.
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5462
    type notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5463
	info at:#type put:type
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5464
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5465
    ^ info
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5466
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5467
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5468
     self getDiskInfoOf:'c:\'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5469
     self getDiskInfoOf:'d:\'
9922
124793486a62 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9484
diff changeset
  5470
     self getDiskInfoOf:'e:\'
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  5471
     self getDiskInfoOf:'f:\'. OperatingSystem lastErrorString
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5472
    "
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5473
10014
6aba6d5620ad volumeName
Claus Gittinger <cg@exept.de>
parents: 9990
diff changeset
  5474
    "Modified: / 26-09-2006 / 16:19:33 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5475
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5476
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5477
getDriveList
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5478
    "return a list of volumes in the system.
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5479
     On unix, no such thing like a volume exists
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5480
     - there, a syntetic list with root, home & current is returned.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5481
     On MSDOS, a list of drive letters is (eventually) returned.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5482
     On VMS, a list of volumes is (eventually) returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5483
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5484
    |list|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5485
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5486
    list := OrderedCollection new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5487
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5488
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5489
     * add drive letters as strings to list ...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5490
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5491
    char buffer[1024];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5492
    char *cp;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5493
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5494
    GetLogicalDriveStrings(1023, buffer);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5495
    for (cp=buffer; *cp; ) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5496
      __SSEND1(list, @symbol(add:), 0, __MKSTRING(cp));
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5497
      cp += strlen(cp) + 1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5498
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5499
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5500
    ^ list
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5501
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5502
11247
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5503
getDriveType:aPathName
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5504
    "returns:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5505
	0 -> Unknown
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5506
	1 -> Invalid
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5507
	2 -> removable
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5508
	3 -> fixed
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5509
	4 -> remote
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5510
	5 -> cdrom
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5511
	6 -> ramdisk.
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5512
    This is a stupid interface - do not use."
11247
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5513
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5514
%{
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5515
    int ret;
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5516
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5517
    if (__isStringLike(aPathName)) {
11247
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5518
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5519
	char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5520
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5521
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5522
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5523
	    __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
  5524
	    // 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
  5525
	    ret = (int)(STX_API_NOINT_CALL1( "GetDriveType", GetDriveType, _aPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5526
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5527
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5528
	ret = GetDriveType((char *) __stringVal(aPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5529
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5530
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5531
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5532
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5533
	RETURN (__MKSMALLINT(ret));
11247
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5534
    }
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5535
%}.
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5536
    ^ self primitiveFailed
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5537
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5538
    "
11291
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5539
     self getDriveType:'x:\'
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5540
     self getDriveType:'C:\'
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5541
     self getDriveType:'D:\'
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5542
    "
11247
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5543
!
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5544
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5545
getFileVersionInfoOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5546
    "retrieves the versionData from an executable or dll.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5547
     The returned value is either a byteArray, which should be
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5548
     processed further with extractVersionValue (VerQueryValue),
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5549
     or nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5550
     This is a WIN32 specific entry, not for common usage."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5551
%{
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5552
    int sz;
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5553
    DWORD dummy;
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5554
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5555
    if (__isStringLike(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5556
	sz = GetFileVersionInfoSizeA(__stringVal(aPathName), &dummy);
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5557
    } else if (__isUnicode16String(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5558
	sz = GetFileVersionInfoSizeW(__unicode16StringVal(aPathName), &dummy);
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5559
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5560
	goto badArgument;
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5561
    }
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5562
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5563
    if (sz > 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5564
	OBJ versionData;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5565
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5566
	versionData = __BYTEARRAY_UNINITIALIZED_NEW_INT(sz);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5567
	if (versionData == nil) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5568
	    RETURN (nil);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5569
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5570
	if (GetFileVersionInfo(__stringVal(aPathName), 0, sz, __ByteArrayInstPtr(versionData)->ba_element) == FALSE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5571
	    RETURN (nil);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5572
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5573
	RETURN (versionData);
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5574
    }
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5575
    RETURN (nil);
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5576
badArgument: ;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5577
%}.
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5578
    self primitiveFailed
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5579
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5580
    "Modified: / 05-07-2006 / 16:56:06 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5581
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5582
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5583
getLongPathName:aPathName
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5584
    "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
  5585
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5586
%{
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5587
    int ret;
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  5588
    wchar_t _aPathName[MAXPATHLEN+1];
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5589
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5590
    if (__isStringLike(aPathName)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5591
	int i;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5592
	INT l = __stringSize(aPathName);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5593
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5594
	if (l > MAXPATHLEN) l = MAXPATHLEN;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5595
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5596
	for (i=0; i<l; i++) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5597
	    _aPathName[i] = __stringVal(aPathName)[i];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5598
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5599
	_aPathName[i] = 0;
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5600
    } else if (__isUnicode16String(aPathName)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5601
	int i;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5602
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5603
	INT l = __unicode16StringSize(aPathName);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5604
	if (l > MAXPATHLEN) l = MAXPATHLEN;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5605
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5606
	for (i=0; i<l; i++) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5607
	    _aPathName[i] = __unicode16StringVal(aPathName)[i];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5608
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5609
	_aPathName[i] = 0;
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5610
    } else
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5611
	goto badArgument;
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5612
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5613
#ifdef DO_WRAP_CALLS
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5614
     do {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5615
	 __threadErrno = 0;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5616
	 // 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
  5617
	 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
  5618
     } while ((ret == 0) && (__threadErrno == EINTR));
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5619
#else
13780
2f055d86569e visual c compilability
Claus Gittinger <cg@exept.de>
parents: 13778
diff changeset
  5620
     ret = GetLongPathNameW(_aPathName, _aPathName, MAXPATHLEN);
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5621
     if (ret == 0) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  5622
	 __threadErrno = __WIN32_ERR(GetLastError());
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5623
     }
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5624
#endif
18964
774cb1e6201e #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18962
diff changeset
  5625
     RETURN (__mkStringOrU16String_maxlen(_aPathName, MAXPATHLEN));
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5626
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5627
badArgument:;
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5628
%}.
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5629
    ^ self primitiveFailed
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5630
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5631
    "
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5632
     self getLongPathName:'x:\'
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  5633
     self getLongPathName:'c:\Dokumente und Einstellungen'
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  5634
     self getShortPathName:'c:\Dokumente und Einstellungen'
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5635
    "
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5636
!
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5637
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5638
getNullDevice
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5639
    "get the name of the null-device."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5640
8755
8e67c864b126 Fix #getNullDevice
Stefan Vogel <sv@exept.de>
parents: 8742
diff changeset
  5641
    ^ 'nul:'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5642
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5643
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
  5644
getObjectFileInfoFor:aStringOrFilename
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
  5645
    "Return and info object for given executable or shared object
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
  5646
     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
  5647
     shared object.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
  5648
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
  5649
     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
  5650
     least
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
  5651
	#isFor32BitArchitecture
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
  5652
	#isFor64BitArchitecture ... returns true, if the given object is for
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
  5653
				     32bit, 64bit architecture respectively
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
  5654
    "
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
  5655
    ^ PECOFFFileHeader fromFile: aStringOrFilename
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
  5656
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
  5657
    "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
  5658
!
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
  5659
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5660
getShortPathName:aPathName
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5661
    "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
  5662
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
    int ret;
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  5665
    wchar_t _aPathName[MAXPATHLEN+1];
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5666
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5667
    if (__isStringLike(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5668
	int i;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5669
	int l = __stringSize(aPathName);
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  5670
	if (l > MAXPATHLEN) l = MAXPATHLEN;
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5671
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5672
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5673
	    _aPathName[i] = __stringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5674
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5675
	_aPathName[i] = 0;
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5676
    } else if (__isUnicode16String(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5677
	int i;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5678
	int l = __unicode16StringSize(aPathName);
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  5679
	if (l > MAXPATHLEN) l = MAXPATHLEN;
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5680
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5681
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5682
	    _aPathName[i] = __unicode16StringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5683
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5684
	_aPathName[i] = 0;
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5685
    } else
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5686
	goto badArgument;
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5687
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5688
#ifdef DO_WRAP_CALLS
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5689
     do {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5690
	 __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
  5691
	 // 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
  5692
	 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
  5693
     } while ((ret == 0) && (__threadErrno == EINTR));
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5694
#else
13780
2f055d86569e visual c compilability
Claus Gittinger <cg@exept.de>
parents: 13778
diff changeset
  5695
     ret = GetShortPathNameW(_aPathName, _aPathName, MAXPATHLEN);
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5696
     if (ret == 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5697
	 __threadErrno = __WIN32_ERR(GetLastError());
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5698
     }
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5699
#endif
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5700
     RETURN ( __MKU16STRING(_aPathName));
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5701
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5702
badArgument:;
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5703
%}.
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5704
    ^ self primitiveFailed
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5705
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5706
    "
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5707
     self getShortPathName:'x:\'
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  5708
     self getShortPathName:'c:\Dokumente und Einstellungen'
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  5709
     self getLongPathName:'c:\Dokumente und Einstellungen'
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5710
    "
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5711
!
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5712
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5713
getVolumeInformation: rootPath
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5714
    name: volumeNameBuffer
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5715
    nameSize: volumeNameSize
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5716
    serialNumber: serialNumber
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5717
    maximumComponentLength: maximumComponentLength
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5718
    fileSystemFlags: fileSystemFlags
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5719
    fileSystemName: fileSystemName
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5720
    fileSystemNameSize: fileSystemNameSize
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5721
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5722
    <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
  5723
    ^self primitiveFailed
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5724
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5725
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5726
infoOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5727
    "return some object filled with info for the file 'aPathName';
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5728
     the info (for which corresponding access methods are understood by
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5729
     the returned object) is:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5730
	 type            - a symbol giving the files type
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5731
	 mode            - numeric access mode
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5732
	 uid             - owners user id
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5733
	 gid             - owners group id
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5734
	 size            - files size
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5735
	 id              - files number (i.e. inode number)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5736
	 accessed        - last access time (as Timestamp)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5737
	 modified        - last modification time (as Timestamp)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5738
	 statusChanged   - last status change time (as Timestamp)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5739
	 alternativeName - (windows only:) the MSDOS name of the file
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5740
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5741
     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
  5742
     all of the information.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5743
     Return nil if such a file does not exist.
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5744
     For symbolic links (if supported by the OS),
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5745
     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
  5746
     use #linkInfoOf: to get info about the link itself.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5747
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5748
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5749
    |info target|
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5750
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5751
    info := self linkInfoOf:aPathName.
10164
2a98bef917b7 care for nil linkInfo
ca
parents: 10161
diff changeset
  5752
    (info notNil and:[info isSymbolicLink]) ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5753
	target := info path.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5754
	target notNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5755
	    ^ self linkInfoOf:target.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5756
	]
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5757
    ].
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5758
    ^ info
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5759
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5760
   "
6377
0113dcb902c5 simulate :drive as a directory
Claus Gittinger <cg@exept.de>
parents: 6372
diff changeset
  5761
    OperatingSystem infoOf:'c:\windows'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5762
    OperatingSystem infoOf:'stx.exe'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5763
    (OperatingSystem infoOf:'/') uid
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5764
    (OperatingSystem infoOf:'/') accessed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5765
   "
6377
0113dcb902c5 simulate :drive as a directory
Claus Gittinger <cg@exept.de>
parents: 6372
diff changeset
  5766
10373
92efacf8b050 getLinkTarget is now done lazyly.
Claus Gittinger <cg@exept.de>
parents: 10365
diff changeset
  5767
    "Modified: / 07-02-2007 / 10:37:14 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5768
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5769
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5770
isDirectory:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5771
    "return true, if 'aPathName' is a valid directory path name.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5772
     (i.e. exists and is a directory).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5773
     This also returns true for symbolic links pointing to a directory;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5774
     if you need to check for this, use #linkInfo:."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5775
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5776
%{
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5777
    int ret;
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5778
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5779
    if (__isStringLike(aPathName)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5780
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5781
	char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5782
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5783
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5784
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5785
	    __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
  5786
	    // 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
  5787
	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5788
	} while ((ret == -1) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5789
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5790
	ret = GetFileAttributesA((char *) __stringVal(aPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5791
	if (ret == -1) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5792
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5793
	}
12715
1ef13bfe9cbb changed:15 methods
sr
parents: 12686
diff changeset
  5794
#endif
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5795
    } else if (__isUnicode16String(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5796
	wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5797
	int i, l;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5798
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5799
	l = __unicode16StringSize(aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5800
	if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5801
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5802
	    _wPathName[i] = __unicode16StringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5803
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5804
	_wPathName[i] = 0;
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5805
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5806
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5807
	    __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
  5808
	    // 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
  5809
	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5810
	} while ((ret == -1) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5811
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5812
	ret = GetFileAttributesW(_wPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5813
	if (ret == -1) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5814
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5815
	}
12715
1ef13bfe9cbb changed:15 methods
sr
parents: 12686
diff changeset
  5816
#endif
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5817
    } else
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5818
	goto err;
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5819
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5820
    if (ret < 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5821
	@global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5822
	RETURN ( false );
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5823
    }
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5824
    RETURN ( (ret & FILE_ATTRIBUTE_DIRECTORY) ? true : false);
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5825
err:;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5826
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5827
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5828
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5829
    "an alternative implementation would be:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5830
	^ (self infoOf:aPathName) type == #directory
11291
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5831
    "
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5832
    "
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5833
     self isDirectory:'.'
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5834
     self isDirectory:'.' asUnicode16String
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5835
    "
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5836
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5837
    "Modified: / 05-07-2006 / 17:23:42 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5838
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5839
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5840
isExecutable:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5841
    "return true, if the given file is executable.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5842
     For symbolic links, the pointed-to-file is checked."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5843
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5844
    "/
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5845
    "/ under windows, there is no executable attribute ...
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5846
    "/ so, only check for the files existence here.
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5847
    "/
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5848
    ^ self isValidPath:aPathName.
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5849
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5850
    "Modified: / 05-07-2006 / 17:23:19 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5851
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5852
10596
072effcc1e88 added #isHidden
sr
parents: 10585
diff changeset
  5853
isHidden:aPathName
072effcc1e88 added #isHidden
sr
parents: 10585
diff changeset
  5854
    "return true, if the given file is hidden"
072effcc1e88 added #isHidden
sr
parents: 10585
diff changeset
  5855
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5856
    |attr|
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5857
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5858
    attr := self primGetFileAttributes:aPathName.
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5859
    attr notNil ifTrue:[^ attr bitTest: FILE_ATTRIBUTE_HIDDEN ].
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5860
    ^ false
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5861
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5862
    "
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5863
     self isHidden:'.'
11291
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5864
     self isHidden:'.' asUnicode16String
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5865
    "
10596
072effcc1e88 added #isHidden
sr
parents: 10585
diff changeset
  5866
!
072effcc1e88 added #isHidden
sr
parents: 10585
diff changeset
  5867
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5868
isReadable:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5869
    "return true, if the file/dir 'aPathName' is readable.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5870
     For symbolic links, the pointed-to-file is checked."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5871
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5872
%{
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5873
    if (__isStringLike(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5874
	int ret;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5875
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5876
	/*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5877
	 * under windows, all files are readable ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5878
	 * so, only check for the files existence here.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5879
	 */
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
  5880
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5881
	char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5882
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5883
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5884
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5885
	    __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
  5886
	    // 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
  5887
	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5888
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5889
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5890
	ret = GetFileAttributesA((char *) __stringVal(aPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5891
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5892
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5893
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5894
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5895
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5896
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5897
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5898
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5899
	RETURN (true);
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5900
    }
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5901
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5902
    if (__isUnicode16String(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5903
	int ret;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5904
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5905
	/*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5906
	 * under windows, all files are readable ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5907
	 * so, only check for the files existence here.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5908
	 */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5909
	wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5910
	int i, l;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5911
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5912
	l = __unicode16StringSize(aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5913
	if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5914
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5915
	    _wPathName[i] = __unicode16StringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5916
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5917
	_wPathName[i] = 0;
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5918
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5919
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5920
	    __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
  5921
	    // 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
  5922
	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5923
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5924
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5925
	ret = GetFileAttributesW(_wPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5926
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5927
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5928
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5929
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5930
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5931
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5932
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5933
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5934
	RETURN (true);
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5935
    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5936
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5937
    ^ self primitiveFailed
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5938
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5939
    "
11291
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5940
     self isReadable:'.'
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5941
     self isReadable:'.' asUnicode16String
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5942
    "
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5943
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5944
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5945
isTemporary:aPathName
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5946
    "return true, if the given file is a temporary file"
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5947
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5948
    |attr|
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5949
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5950
    attr := self primGetFileAttributes:aPathName.
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5951
    attr notNil ifTrue:[^ attr bitTest: FILE_ATTRIBUTE_TEMPORARY ].
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5952
    ^ false
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5953
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5954
    "
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5955
     self isTemporary:'.'
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5956
     self isTemporary:'.' asUnicode16String
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5957
    "
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5958
!
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5959
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5960
isValidPath:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5961
    "return true, if 'aPathName' is a valid path name
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5962
     (i.e. the file or directory exists)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5963
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5964
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5965
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5966
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5967
    if (__isStringLike(aPathName)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5968
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5969
	char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5970
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5971
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5972
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5973
	    __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
  5974
	    // 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
  5975
	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5976
	} while ((ret == -1) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5977
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5978
	ret = GetFileAttributesA((char *) __stringVal(aPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5979
	if (ret == -1) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5980
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5981
	}
12715
1ef13bfe9cbb changed:15 methods
sr
parents: 12686
diff changeset
  5982
#endif
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5983
    } else  if (__isUnicode16String(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5984
	wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5985
	int i, l;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5986
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5987
	l = __unicode16StringSize(aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5988
	if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5989
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5990
	    _wPathName[i] = __unicode16StringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5991
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5992
	_wPathName[i] = 0;
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5993
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5994
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5995
	    __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
  5996
	    // 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
  5997
	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5998
	} while ((ret == -1) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5999
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6000
	ret = GetFileAttributesW(_wPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6001
	if (ret == -1) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6002
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6003
	}
12715
1ef13bfe9cbb changed:15 methods
sr
parents: 12686
diff changeset
  6004
#endif
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6005
    } else
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6006
	goto err;
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6007
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6008
    if (ret == -1) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6009
	@global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6010
	RETURN ( false );
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6011
    }
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6012
    RETURN (true);
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6013
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6014
err:;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6015
%}.
15039
aad511684e79 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14889
diff changeset
  6016
    aPathName isString ifTrue:[
aad511684e79 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14889
diff changeset
  6017
	aPathName isUnicode32String ifTrue:[
aad511684e79 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14889
diff changeset
  6018
	    "/ WIN32 only support 16 bit (wide) strings
aad511684e79 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14889
diff changeset
  6019
	    ^ self isValidPath:aPathName asUnicode16String
aad511684e79 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14889
diff changeset
  6020
	]
aad511684e79 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14889
diff changeset
  6021
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6022
    ^ self primitiveFailed
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  6023
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  6024
    "Modified: / 05-07-2006 / 17:23:51 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6025
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6026
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6027
isWritable:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6028
    "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
  6029
     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
  6030
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  6031
     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
  6032
     See http://support.microsoft.com/kb/326549.
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6033
     So we always return true for directories."
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6034
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6035
    |attr|
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6036
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6037
    attr := self primGetFileAttributes:aPathName.
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6038
    attr notNil ifTrue:[
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  6039
	^ (attr bitAnd: (FILE_ATTRIBUTE_DIRECTORY bitOr: FILE_ATTRIBUTE_READONLY ))
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  6040
	    ~~ FILE_ATTRIBUTE_READONLY
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6041
    ].
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6042
    ^ false
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6043
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6044
    "
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  6045
     self isWritable:'.'
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  6046
     self isWritable:'.' asUnicode16String
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6047
     self isWritable:'' asUnicode16String
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  6048
    "
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6049
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6050
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6051
linkInfoOf:aPathName
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6052
    "return some object filled with info for the file 'aPathName';
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6053
     the info (for which corresponding access methods are understood by
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6054
     the returned object) is:
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6055
	 type            - a symbol giving the files type
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6056
	 mode            - numeric access mode
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6057
	 uid             - owners user id
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6058
	 gid             - owners group id
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6059
	 size            - files size
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6060
	 id              - files number (i.e. inode number)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6061
	 accessed        - last access time (as Timestamp)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6062
	 modified        - last modification time (as Timestamp)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6063
	 statusChanged   - last status change time (as Timestamp)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6064
	 alternativeName - (windows only:) the MSDOS name of the file
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6065
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6066
     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
  6067
     all of the information.
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6068
     Return nil if such a file does not exist.
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  6069
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  6070
     Return the info about the link itself,
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  6071
     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
  6072
     in case of a symbolic link.
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6073
    "
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6074
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6075
    |info type mode uid gid size id
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6076
     atime mtime ctime
12821
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
  6077
     aOsTime mOsTime cOsTime
11258
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
  6078
     fileName alternativeName|
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6079
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6080
%{
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6081
    BOOL result;
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6082
    int ret;
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6083
    wchar_t alternativeFileNameBuffer[15];
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  6084
    wchar_t fileNameBuffer[MAXPATHLEN+1];
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6085
    int modeBits = 0;
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6086
    WIN32_FILE_ATTRIBUTE_DATA fileAttributeData;
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6087
    unsigned INT ino;
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  6088
    wchar_t _aPathName[MAXPATHLEN+1];
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6089
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  6090
    if (__isStringLike(aPathName)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6091
	int i;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6092
	int l = __stringSize(aPathName);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6093
	if (l > MAXPATHLEN) l = MAXPATHLEN;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6094
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6095
	for (i=0; i<l; i++) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6096
	    _aPathName[i] = __stringVal(aPathName)[i];
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
	_aPathName[i] = 0;
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6099
    } else if (__isUnicode16String(aPathName)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6100
	int i;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6101
	int l = __unicode16StringSize(aPathName);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6102
	if (l > MAXPATHLEN) l = MAXPATHLEN;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6103
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6104
	for (i=0; i<l; i++) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6105
	    _aPathName[i] = __unicode16StringVal(aPathName)[i];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6106
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6107
	_aPathName[i] = 0;
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6108
    } else
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6109
	goto badArgument;
11291
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  6110
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6111
#ifdef DO_WRAP_CALLS
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6112
    {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6113
	do {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6114
	    __threadErrno = 0;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6115
	    // 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
  6116
	    result = (int)(STX_API_NOINT_CALL3( "GetFileAttributesExW", GetFileAttributesExW, _aPathName, GetFileExInfoStandard, &fileAttributeData));
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6117
	} while (!result && (__threadErrno == EINTR));
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6118
    }
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6119
#else
11811
530bb21f57f9 #linkInfoOf:
Stefan Vogel <sv@exept.de>
parents: 11810
diff changeset
  6120
    result = GetFileAttributesExW(_aPathName, GetFileExInfoStandard, &fileAttributeData);
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6121
    if (!result) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6122
	__threadErrno = __WIN32_ERR(GetLastError());
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6123
    }
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6124
#endif
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6125
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6126
    if (!result) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6127
	@global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6128
    } else {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6129
	id = __mkSmallInteger(0);   /* could get it by opening ... */
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6130
	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
  6131
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6132
//        if (fileAttributeData.cFileName[0] != '\0') {
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  6133
//            bcopy(fileAttributeData.cFileName, fileNameBuffer, MAXPATHLEN*sizeof(wchar_t));
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  6134
//            fileNameBuffer[MAXPATHLEN] = '\0';
18964
774cb1e6201e #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18962
diff changeset
  6135
//            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
  6136
//        }
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6137
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6138
//        if (fileAttributeData.cAlternateFileName[0] != '\0') {
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  6139
//            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
  6140
//            alternativeFileNameBuffer[14] = '\0';
18964
774cb1e6201e #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18962
diff changeset
  6141
//            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
  6142
//        }
11779
73c3f28d8960 Fix write access checking fpr directories in Windows.
Stefan Vogel <sv@exept.de>
parents: 11767
diff changeset
  6143
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6144
	/*
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6145
	 * simulate access bits
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6146
	 */
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6147
	if (fileAttributeData.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6148
	    modeBits = 0444;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6149
	} else {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6150
	    modeBits = 0666;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6151
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6152
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6153
	if (fileAttributeData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6154
	    type = @symbol(directory);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6155
	    modeBits = 0777;   /* executable and WRITABLE - refer to comment in #isWritable: */
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6156
	} else if (fileAttributeData.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6157
	    type = @symbol(symbolicLink);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6158
	    modeBits = 0777;   /* even in UNIX symlinks have 0777 */
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6159
	} else {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6160
	    type = @symbol(regular);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6161
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6162
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6163
	mode = __mkSmallInteger(modeBits);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6164
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  6165
	cOsTime = FileTimeToOsTime1970(&fileAttributeData.ftCreationTime);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  6166
	aOsTime = FileTimeToOsTime1970(&fileAttributeData.ftLastAccessTime);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  6167
	mOsTime = FileTimeToOsTime1970(&fileAttributeData.ftLastWriteTime);
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6168
    }
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6169
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6170
  badArgument: ;
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6171
%}.
11811
530bb21f57f9 #linkInfoOf:
Stefan Vogel <sv@exept.de>
parents: 11810
diff changeset
  6172
10161
fd6b02ffb383 avoid recursion
Claus Gittinger <cg@exept.de>
parents: 10160
diff changeset
  6173
    (aPathName endsWith:'.lnk') ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6174
	type := #symbolicLink.
19869
544677bffb97 #DOCUMENTATION
mawalch
parents: 19668
diff changeset
  6175
	"/ now done lazily in FileStatusInfo, when the path is accessed
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6176
	"/ path := self getLinkTarget:aPathName.
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6177
    ].
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6178
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6179
    mode isNil ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6180
	(self isDirectory:aPathName) ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6181
	    "/ the code above fails for root directories (these do not exist).
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6182
	    "/ simulate here
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6183
	    mode := 8r777.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6184
	    type := #directory.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6185
	    uid := gid := 0.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6186
	    size := 0.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6187
	    id := 0.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6188
	    atime := mtime := ctime := Timestamp now.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6189
	].
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6190
    ].
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6191
    mode notNil ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6192
	atime isNil ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6193
	    "/ 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
  6194
	    "/ aOsTime := aOsTime - self osTimeOf19700101. -- already done
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6195
	    atime := Timestamp new fromOSTime:aOsTime.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6196
	].
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6197
	mtime isNil ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6198
	    "/ 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
  6199
	    "/ mOsTime := mOsTime - self osTimeOf19700101. -- already done
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6200
	    mtime := Timestamp new fromOSTime:mOsTime.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6201
	].
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6202
	ctime isNil ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6203
	    "/ 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
  6204
	    "/ cOsTime := cOsTime - self osTimeOf19700101. -- already done
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6205
	    ctime := Timestamp new fromOSTime:cOsTime.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6206
	].
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6207
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6208
	info := FileStatusInfo
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6209
		    type:type mode:mode
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6210
		    uid:uid gid:gid
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6211
		    size:size
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6212
		    id:id
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6213
		    accessed:atime modified:mtime created:ctime
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6214
		    sourcePath:aPathName
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6215
		    fullName:fileName alternativeName:alternativeName.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  6216
	^ info
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6217
   ].
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6218
   ^ nil
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6219
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6220
   "
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6221
    OperatingSystem linkInfoOf:'c:\windows'
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  6222
    OperatingSystem linkInfoOf:'stx.exe'
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  6223
    (OperatingSystem linkInfoOf:'/') uid
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  6224
    (OperatingSystem linkInfoOf:'/') accessed
11811
530bb21f57f9 #linkInfoOf:
Stefan Vogel <sv@exept.de>
parents: 11810
diff changeset
  6225
    OperatingSystem linkInfoOf:'C:\Dokumente und Einstellungen\stefan\Desktop\System.lnk'
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6226
   "
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  6227
10373
92efacf8b050 getLinkTarget is now done lazyly.
Claus Gittinger <cg@exept.de>
parents: 10365
diff changeset
  6228
    "Modified: / 07-02-2007 / 10:30:14 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6229
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6230
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6231
mimeTypeForSuffix:aFileSuffix
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6232
    "given a file suffix, return a corresponding mimeType.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6233
     Here, the Registry is consulted.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6234
     Returns nil if no mimeType for the given suffix is known."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6235
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6236
    ^ RegistryEntry
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6237
	stringValueFor:'Content Type'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6238
	atKey:('HKEY_CLASSES_ROOT\.' , aFileSuffix)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6239
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6240
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6241
     self mimeTypeForSuffix:'au'
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6242
     self mimeTypeForSuffix:'st'
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6243
     self mimeTypeForSuffix:'dll'
9013
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  6244
    "
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6245
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6246
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6247
parentDirectoryName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6248
    "return the name used to refer to parent directories.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6249
     In MSDOS, Unix and other systems this is '..', but maybe different
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6250
     for other systems.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6251
     (but those are currently not supported - so this is some
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6252
      preparation for the future)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6253
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
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6256
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6257
pathNameOf:pathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6258
    "return the pathName of the argument, aPathString,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6259
     - thats the full pathname of the directory, starting at '/'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6260
     This method needs the path to be valid
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6261
     (i.e. all directories must exist, be readable and executable).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6262
     Notice: if symbolic links are involved, the result may look different
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6263
     from what you expect."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6264
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6265
    |p path|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6266
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6267
    "some systems have a convenient function for this ..."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6268
    path := self primPathNameOf:pathName.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6269
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6270
    path isNil ifTrue:[
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6271
	(self isValidPath:pathName) ifFalse:[
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6272
	    p := pathName.
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6273
	    [(p size > 1)
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6274
	     and:[p endsWith:(self fileSeparator)]
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6275
	    ] whileTrue:[
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6276
		p := p copyButLast:1.
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6277
	    ].
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6278
	    ^ p
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6279
	].
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6280
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6281
	"/
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6282
	"/ return the original - there is nothing else can we do
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6283
	"/
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6284
	path := self compressPath:pathName
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6285
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6286
    ^ path.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6287
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6288
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6289
     OperatingSystem pathNameOf:'.'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6290
     OperatingSystem pathNameOf:'../smalltalk/../smalltalk'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6291
     OperatingSystem pathNameOf:'../../..'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6292
     OperatingSystem pathNameOf:'..'
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6293
     OperatingSystem pathNameOf:'/tmp////'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6294
     OperatingSystem pathNameOf:'/foo/bar'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6295
     OperatingSystem pathNameOf:'/foo/bar/'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6296
     OperatingSystem pathNameOf:'/foo/bar//'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6297
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6298
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6299
    "Modified: 29.11.1996 / 18:02:12 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6300
    "Modified: 10.1.1997 / 19:10:42 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6301
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6302
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6303
primGetFileAttributes:aPathName
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6304
    "get the file-attributes"
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6305
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6306
    |errorNumber|
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6307
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6308
%{
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6309
    int ret;
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6310
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  6311
    if (__isStringLike(aPathName)) {
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6312
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6313
	char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6314
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6315
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6316
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6317
	    __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
  6318
	    // 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
  6319
	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6320
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6321
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6322
	ret = GetFileAttributesA((char *) __stringVal(aPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6323
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6324
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6325
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6326
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6327
	if (ret >= 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6328
	    RETURN ( __mkSmallInteger(ret) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6329
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6330
	__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6331
	RETURN (nil);
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6332
    }
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6333
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6334
    if (__isUnicode16String(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6335
	wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6336
	int i, l;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6337
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6338
	l = __unicode16StringSize(aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6339
	if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6340
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6341
	    _wPathName[i] = __unicode16StringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6342
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6343
	_wPathName[i] = 0;
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6344
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6345
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6346
	    __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
  6347
	    // 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
  6348
	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6349
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6350
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6351
	ret = GetFileAttributesW(_wPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6352
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6353
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6354
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6355
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6356
	if (ret >= 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6357
	    RETURN ( __mkSmallInteger(ret) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6358
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6359
	__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6360
	RETURN (nil);
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6361
    }
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6362
%}.
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6363
    ^ self primitiveFailed
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6364
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6365
    "
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6366
     self primGetFileAttributes:'.'
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6367
     self primGetFileAttributes:'bc.mak'
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6368
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6369
     self primGetFileAttributes:'.' asUnicodeString
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  6370
     self primGetFileAttributes:'bc.mak' asUnicodeString
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6371
    "
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6372
!
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6373
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6374
primIdOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6375
    "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
  6376
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6377
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6378
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6379
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6380
primPathNameOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6381
    "return the pathName of the argument, aPathString,
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6382
     - thats the full pathname of the directory, starting at 'X:\'.
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6383
     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
  6384
     Notice: if symbolic links are involved, the result may look different
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6385
     from what you expect."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6386
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6387
    |error|
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6388
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6389
%{
9390
a0c059f2477c #primPathNameOf: -- allow symbol as arg (sv)
ca
parents: 9384
diff changeset
  6390
    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
  6391
	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
  6392
	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
  6393
	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
  6394
	int rslt;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6395
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
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
	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
  6398
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6399
	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
  6400
	do {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6401
	    __threadErrno = 0;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6402
	    // 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
  6403
	    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
  6404
	} 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
  6405
#else
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6406
	rslt = GetFullPathNameA(__stringVal(aPathName), MAXPATHLEN, nameBuffer, NULL);
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6407
#endif
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6408
	returnedName = nameBuffer;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6409
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6410
	if (rslt > 0) {
8652
793cc6e353bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8651
diff changeset
  6411
#ifdef DO_WRAP_CALLS
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6412
	    do {
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6413
		__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
  6414
		// 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
  6415
		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
  6416
	    } while ((rslt < 0) && (__threadErrno == EINTR));
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6417
#else
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6418
	    rslt = GetLongPathNameA(nameBuffer, nameBuffer2, MAXPATHLEN);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6419
#endif
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6420
	    returnedName = nameBuffer2;
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
	if (rslt > 0) {
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6423
	    RETURN ( __MKSTRING(returnedName) );
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6424
	}
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6425
	__threadErrno = __WIN32_ERR(GetLastError());
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6426
	RETURN (nil);
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6427
    }
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6428
    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
  6429
	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
  6430
	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
  6431
	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
  6432
	int rslt;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6433
	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
  6434
	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
  6435
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6436
	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
  6437
	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
  6438
	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
  6439
	    _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
  6440
	}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6441
	_aPathName[i] = 0;
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6442
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6443
#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
  6444
	do {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6445
	    __threadErrno = 0;
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  6446
	    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
  6447
	} 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
  6448
#else
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6449
	rslt = GetFullPathNameW(_aPathName, MAXPATHLEN, nameBuffer, NULL);
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  6450
#endif
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  6451
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6452
	returnedName = nameBuffer;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6453
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6454
	if (rslt > 0) {
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  6455
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6456
#ifdef DO_WRAP_CALLS
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6457
	    do {
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6458
		__threadErrno = 0;
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
  6459
		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
  6460
	    } while ((rslt < 0) && (__threadErrno == EINTR));
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6461
#else
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6462
	    rslt = GetLongPathNameW(nameBuffer, nameBuffer2, MAXPATHLEN);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6463
#endif
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6464
	    returnedName = nameBuffer2;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6465
	}
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6466
	if (rslt > 0) {
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6467
	    RETURN ( __MKU16STRING(returnedName) );
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6468
	}
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6469
	__threadErrno = __WIN32_ERR(GetLastError());
15377
3ea5dc7aae24 ouch: primPathName with an Unicode argument reported primFail
Claus Gittinger <cg@exept.de>
parents: 15369
diff changeset
  6470
	RETURN (nil);
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6471
    }
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6472
    error = @symbol(argument);     // argument is not a string or unicode16string
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6473
%}.
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  6474
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6475
    error notNil ifTrue:[
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6476
	self primitiveFailed:error.
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6477
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6478
    ^ nil
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6479
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6480
    "
11291
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  6481
     self primPathNameOf:'.'
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6482
     self primPathNameOf:'.' asUnicode16String
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6483
     self primPathNameOf:5555
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6484
    "
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6485
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6486
12616
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6487
primSetCurrentDirectoryA:pathName
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6488
    <apicall: bool "SetCurrentDirectoryA" ( pointer ) module: "kernel32.dll" >
12616
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6489
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6490
    self primitiveFailed.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6491
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6492
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6493
     self primSetCurrentDirectory:'C:\Dokumente und Einstellungen\User\Eigene Dateien\work5\stx\projects\smalltalk'.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6494
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6495
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6496
    "Created: / 27-07-2006 / 14:47:12 / fm"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6497
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6498
12616
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6499
primSetCurrentDirectoryW:pathName
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6500
    <apicall: bool "SetCurrentDirectoryW" ( pointer ) module: "kernel32.dll" >
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6501
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6502
    self primitiveFailed.
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6503
!
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6504
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6505
primSetFileAttributes:aPathName to:anInteger
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6506
    "set the file-attributes; return true if the set did happen"
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6507
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6508
    |errorNumber|
10622
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6509
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6510
%{
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6511
    int ret;
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6512
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  6513
    if (__isSmallInteger(anInteger)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6514
	if (__isStringLike(aPathName)) {
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6515
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6516
	    char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6517
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6518
	    strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6519
	    do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6520
		__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
  6521
		// 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
  6522
		ret = (int)(STX_API_NOINT_CALL2( "SetFileAttributesA", SetFileAttributesA, _aPathName, __intVal(anInteger)));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6523
	    } while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6524
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6525
	    ret = SetFileAttributesA((char *) __stringVal(aPathName), __intVal(anInteger));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6526
	    if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6527
		__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6528
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6529
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6530
	    if (ret >= 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6531
		RETURN ( true );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6532
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6533
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6534
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6535
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6536
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6537
	if (__isUnicode16String(aPathName)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6538
	    wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6539
	    int i, l;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6540
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6541
	    l = __unicode16StringSize(aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6542
	    if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6543
	    for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6544
		_wPathName[i] = __unicode16StringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6545
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6546
	    _wPathName[i] = 0;
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6547
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6548
	    do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6549
		__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
  6550
		// 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
  6551
		ret = (int)(STX_API_NOINT_CALL2( "SetFileAttributesW", SetFileAttributesW, _wPathName, __intVal(anInteger)));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6552
	    } while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6553
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6554
	    ret = SetFileAttributesW(_wPathName, __intVal(anInteger));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6555
	    if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6556
		__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6557
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6558
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6559
	    if (ret >= 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6560
		RETURN ( true );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6561
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6562
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6563
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6564
	}
10622
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6565
    }
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6566
%}.
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6567
    ^ self primitiveFailed
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6568
!
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6569
12616
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6570
setCurrentDirectory:pathName
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6571
    pathName bitsPerCharacter == 16 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6572
	self primSetCurrentDirectoryW:(pathName copyWith:(Character value:0))
12616
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6573
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6574
	self primSetCurrentDirectoryA:pathName
12616
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6575
    ].
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6576
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6577
    "
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6578
     self getCurrentDirectory
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6579
     self setCurrentDirectory:'C:\Users\cg\work\stx\projects'
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6580
     self getCurrentDirectory
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6581
     self setCurrentDirectory:'C:\Users\cg\work\stx\projects\smalltalk'
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6582
    "
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6583
!
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6584
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6585
setHidden:aPathName
12969
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  6586
    "set the hidden attribute. Return true if the operation succeeded"
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6587
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6588
    |attr|
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6589
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6590
    attr := self primGetFileAttributes:aPathName.
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6591
    (attr bitTest:FILE_ATTRIBUTE_HIDDEN ) ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6592
	^ self primSetFileAttributes:aPathName to:(attr bitOr:2).
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6593
    ].
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6594
    ^ true  "/ aready set
12969
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  6595
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  6596
    "Modified: / 29-07-2010 / 11:32:26 / sr"
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6597
!
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6598
10622
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6599
setNormal:aPathName
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6600
    " sets all file attributes to the normal state
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6601
      e.g. set the hidden attribute to false (unhidden)"
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6602
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6603
    |attr|
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6604
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6605
    attr := self primGetFileAttributes:aPathName.
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6606
    (attr bitTest:FILE_ATTRIBUTE_NORMAL ) ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6607
	^ self primSetFileAttributes:aPathName to:(attr bitOr:2).
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6608
    ].
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6609
    ^ true  "/ aready set
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6610
!
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6611
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6612
setTemporary:aPathName
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6613
    " set the temporary attribute of aPathName"
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6614
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6615
    |attr|
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6616
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6617
    attr := self primGetFileAttributes:aPathName.
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6618
    (attr bitTest:FILE_ATTRIBUTE_TEMPORARY ) ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6619
	^ self primSetFileAttributes:aPathName to:(attr bitOr:2).
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6620
    ].
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6621
    ^ true  "/ aready set
10622
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6622
!
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6623
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6624
timeOfLastAccess:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6625
    "return the time, when the file was last accessed.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6626
     For nonexistent files, nil is returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6627
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6628
    "could be implemented as:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6629
	(self infoOf:aPathName) accessed
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6630
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6631
    | i|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6632
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6633
    i := self infoOf:aPathName.
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  6634
    i notNil ifTrue:[^ i accessTime].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6635
    ^ nil.
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
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6638
     OperatingSystem timeOfLastAccess:'/'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6639
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6640
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6641
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6642
timeOfLastChange:aPathName
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6643
    "return the time, when the file was last changed.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6644
     For nonexistent files, nil is returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6645
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6646
    "could be implemented as:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6647
	(self infoOf:aPathName) modified
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6648
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6649
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6650
    | i|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6651
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6652
    i := self infoOf:aPathName.
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  6653
    i notNil ifTrue:[^ i modificationTime].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6654
    ^ nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6655
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6656
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6657
     OperatingSystem timeOfLastChange:'/'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6658
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6659
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6660
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6661
typeOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6662
    "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
  6663
     nil is returned.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6664
     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
  6665
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6666
    |i|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6667
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6668
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6669
     this could have been implemented as:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6670
	(self infoOf:aPathName) type
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6671
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6672
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6673
    i := self infoOf:aPathName.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6674
    i notNil ifTrue:[^ i type].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6675
    ^ nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6676
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6677
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6678
     OperatingSystem typeOf:'/'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6679
     OperatingSystem typeOf:'.'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6680
     OperatingSystem typeOf:'Make.proto'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6681
     OperatingSystem typeOf:'resources/motif.style'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6682
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6683
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6684
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6685
volumeLabelOf: aFilenameOrString
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6686
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6687
	"Answer the volume label of the disk containing aFilenameOrString."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6688
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6689
    | volName |
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6690
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6691
    volName := String new: 255.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6692
    ( self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6693
	getVolumeInformation: aFilenameOrString asFilename volume, '\'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6694
	name: volName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6695
	nameSize: volName size
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6696
	serialNumber: nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6697
	maximumComponentLength: nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6698
	fileSystemFlags: nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6699
	fileSystemName: nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6700
	fileSystemNameSize: 0 )
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6701
	    ifFalse: [
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6702
		Transcript showCR:'GetVolumeInformation error'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6703
		^ ''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6704
	].
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6705
    ^ volName copyUpTo: Character null
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6706
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6707
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6708
	self volumeLabelOf: 'C:\pepe.pep'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6709
	self volumeLabelOf: 'C:'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6710
	self volumeLabelOf: 'C:\\'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6711
	self volumeLabelOf: 'C:\'
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6712
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6713
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6714
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6715
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6716
volumeNameOf:aPathString
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6717
    "return the volumeName of the argument, aPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6718
     - thats the name of the volume where aPath is.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6719
     Not all OperatingSystem support/use volumes; on unix,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6720
     this always returns an empty string."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6721
7102
415388639cdd changes claus
penk
parents: 7080
diff changeset
  6722
    aPathString size < 2 ifTrue:[^ ''].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6723
    (aPathString at:2) == $: ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6724
	^ (aPathString at:1) asString.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6725
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6726
    ^ ''
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6727
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6728
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  6729
!Win32OperatingSystem class methodsFor:'help support'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  6730
9988
0126451578fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9955
diff changeset
  6731
openDocumentationFilename: aFilenameOrString
12154
646c4171f0d2 added: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 11920
diff changeset
  6732
    <resource: #obsolete>
646c4171f0d2 added: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 11920
diff changeset
  6733
646c4171f0d2 added: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 11920
diff changeset
  6734
    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
  6735
9990
19a95e470d32 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9988
diff changeset
  6736
    "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
  6737
     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
  6738
     html documents, pdf documents etc."
19a95e470d32 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9988
diff changeset
  6739
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  6740
    Error
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6741
	handle:[:ex |
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6742
	    Dialog warn:'Shell execution failed'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6743
	] do:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6744
	    self openApplicationForDocument:aFilenameOrString operation:#open
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6745
	]
9988
0126451578fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9955
diff changeset
  6746
0126451578fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9955
diff changeset
  6747
    "
0126451578fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9955
diff changeset
  6748
     self openDocumentationFilename: 'C:\WINDOWS\Help\clipbrd.chm' asFilename
10364
43968474508b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10352
diff changeset
  6749
     self openDocumentationFilename: Filename currentDirectory
9988
0126451578fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9955
diff changeset
  6750
    "
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  6751
c57956a348bf printing support
fm
parents: 9431
diff changeset
  6752
    "Created: / 04-08-2006 / 18:04:52 / fm"
10364
43968474508b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10352
diff changeset
  6753
    "Modified: / 26-01-2007 / 14:05:44 / cg"
10160
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6754
!
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6755
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6756
openHelpFile: helpFilename inContextID: contextID withOwner: anApplicationModel
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6757
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6758
    |ownerHandle macro|
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6759
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6760
    anApplicationModel notNil ifTrue:[ownerHandle := anApplicationModel window id].
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6761
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6762
    contextID isNil ifTrue: [^self primWinHelp: ownerHandle helpFile: helpFilename command: 3 "HelpIndex" dwData: nil ].
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6763
    contextID isInteger ifTrue: [^self primWinHelp: ownerHandle helpFile: helpFilename command: 1 "HelpContext" dwData: contextID ].
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6764
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6765
    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
  6766
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6767
    macro := 'JumpId("', helpFilename asFilename baseName , '", "', contextID, '")'.
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6768
    self primWinHelp: nil helpFile: helpFilename command: 258 "HelpCommand" dwData: macro
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6769
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6770
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6771
"
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6772
    self openHelpFile: 'C:\vsw311\dapas.hlp' inContextID: 'IDH_ACI' withOwner: nil
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6773
"
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6774
!
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6775
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6776
primWinHelp: hWnd helpFile: aString command: anInteger dwData: anObject
10276
1e689abbfb18 #primWinHelp: helpFile: command: dwData:
fm
parents: 10274
diff changeset
  6777
    <apicall: bool "WinHelpA" ( handle lpstr int32 lpstr ) module: "user32.dll" >
10160
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6778
    self primitiveFailed.
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6779
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  6780
"
10160
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6781
    anInteger
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6782
    - 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
  6783
    - 3         HelpIndex       to open in the help index
10160
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6784
    - 258       HelpCommand     execute a macro string
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6785
"
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6786
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6787
"
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  6788
    self primWinHelp: nil helpFile: 'C:\vsw311\dapas.hlp' command: 3 dwData: nil
10160
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6789
"
10276
1e689abbfb18 #primWinHelp: helpFile: command: dwData:
fm
parents: 10274
diff changeset
  6790
1e689abbfb18 #primWinHelp: helpFile: command: dwData:
fm
parents: 10274
diff changeset
  6791
    "Modified: / 19-12-2006 / 11:48:15 / User"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  6792
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
  6793
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6794
!Win32OperatingSystem class methodsFor:'interrupts & signals'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6795
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6796
blockingTest
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6797
    "this is a test method;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6798
     For testing double CTRL-C in blocking primitives"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6799
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6800
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6801
    while(1) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6802
	console_printf("blocking...");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6803
	Sleep(50);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6804
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6805
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6806
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6807
     OperatingSystem blockingTest
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6808
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6809
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6810
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6811
blockingTest2
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6812
    "this is a test method;
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6813
     For testing single CTRL-C in blocking primitives"
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6814
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6815
%{
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6816
    while(1) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6817
	console_printf("blocking...");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6818
	STX_API_CALL1("Sleep", Sleep, 50);
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6819
    }
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6820
%}.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6821
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6822
     OperatingSystem blockingTest2
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6823
    "
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6824
!
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6825
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6826
blockingTest3
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6827
    "this is a test method;
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6828
     For testing single CTRL-C in non-interruptable blocking primitives.
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6829
     This one should continue after typing continue in the debugger"
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6830
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6831
%{
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6832
    int ret;
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6833
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6834
    do {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6835
	// 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
  6836
	ret = (int)(STX_API_NOINT_CALL1("Sleep", Sleep, 60000));
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6837
    } while (ret < 0 && __threadErrno == EINTR);
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6838
%}.
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6839
    "
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6840
     OperatingSystem blockingTest3
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6841
    "
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6842
!
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6843
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6844
blockingTest4
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6845
    "this is a test method;
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6846
     For testing single CTRL-C in non-interruptable blocking primitives.
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6847
     This one start a new sleep after typing continue in the debugger"
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6848
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6849
%{
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6850
    int ret;
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6851
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6852
    do {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6853
	// do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6854
	ret = STX_API_CALL1("Sleep", Sleep, 60000);
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6855
    } while (ret < 0 && __threadErrno == EINTR);
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6856
%}.
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6857
    "
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6858
     OperatingSystem blockingTest4
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6859
    "
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6860
!
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6861
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6862
defaultSignal:signalNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6863
    "revert to the default action on arrival of a (Unix-)signal.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6864
     Dont confuse Unix signals with smalltalk signals.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6865
     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
  6866
     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
  6867
     default for SIGQUIT (^ \) is to dump core.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6868
     Also, NOTICE that signal numbers are not portable between unix
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6869
     systems - use OperatingSystem sigXXX to get the numeric value for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6870
     a signal."
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6873
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6874
    if (__isSmallInteger(signalNumber)) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6875
#ifdef SIG_DFL
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6876
	signal(__intVal(signalNumber), SIG_DFL);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6877
	RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6878
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6879
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6880
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6881
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6882
     this error is triggered on non-integer argument
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
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6885
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6886
    "you better save a snapshot image before trying this ..."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6887
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6888
     'if you hit ^C now, Smalltalk will exit immediately' printNewline.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6889
     OperatingSystem defaultSignal:(OperatingSystem sigINT).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6890
     1 to:1000000 do:[:i| ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6891
     OperatingSystem enableSignal:(OperatingSystem sigINT).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6892
     'normal ^C handling again.' printNewline
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6893
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6894
!
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
disableIOInterruptsOn:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6897
    "turn off IO interrupts for a filedescriptor"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6898
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6899
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6900
     this error is triggered on non-integer argument
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6901
     or if the OS does not support IO interrupts.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6902
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6903
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6904
!
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
disableSignal:signalNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6907
    "disable (Unix-) signal processing for signalNumber.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6908
     Dont confuse Unix signals with smalltalk signals.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6909
     WARNING: for some signals, it is no good idea to disable
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6910
     them; for example, disabling the SIGINT signal turns off ^C
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6911
     handling.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6912
     Also, NOTICE that signal numbers are not portable between unix
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6913
     systems - use OperatingSystem sigXXX to get the numeric value for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6914
     a signal.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6915
     Use only for fully debugged stand alone applications."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6916
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6917
%{  /* NOCONTEXT */
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
    if (__isSmallInteger(signalNumber)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6920
	int sigNo = __intVal(signalNumber);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6921
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6922
	if (sigNo == 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6923
	    RETURN (self);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6924
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6925
#ifdef SIG_IGN
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6926
	signal(sigNo, SIG_IGN);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6927
	RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6928
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6929
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6930
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6931
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6932
     this error is triggered on non-integer argument
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6933
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6934
    ^ self primitiveFailed
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
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6937
     'now, ^C is totally ignored ...' printNewline.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6938
     OperatingSystem disableSignal:(OperatingSystem sigINT).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6939
     1 to:1000000 do:[:i| ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6940
     OperatingSystem enableSignal:(OperatingSystem sigINT).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6941
     '^C handled again.' printNewline
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6942
    "
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6945
disableTimer
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6946
    "disable timer interrupts.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6947
     WARNING:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6948
	the system will not operate correctly with timer interrupts
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6949
	disabled, because no scheduling or timeouts are possible."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6950
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6951
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6952
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6953
    extern void __win32ClearTimer();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6954
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6955
    __win32ClearTimer();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6956
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6957
    ^ true
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6958
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6959
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6960
enableChildSignalInterrupts
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  6961
    "childSignal interrupts are not supported in windows"
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  6962
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  6963
    ^ self
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6964
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6965
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6966
enableIOInterruptsOn:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6967
    "turn on IO interrupts for a filedescriptor"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6968
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
     this error is triggered on non-integer argument
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6971
     or if the system does not support SIGIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6972
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6973
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6974
!
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
enableSignal:signalNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6977
    "enable (Unix-)signal processing for signalNumber.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6978
     Dont confuse Unix signals with smalltalk signals.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6979
     The signal will be delivered to one of the standard handlers
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6980
     (SIGINT, SIGQUIT, etc) or to a general handler, which
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6981
     sends #signalInterrupt:.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6982
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6983
     NOTICE that signal numbers are not portable between unix
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6984
     systems - use OperatingSystem sigXXX to get the numeric value for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6985
     a signal."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6986
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6987
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6988
11669
db58374346b3 Define (and handle) the HUP and PWR signals
Stefan Vogel <sv@exept.de>
parents: 11623
diff changeset
  6989
# define SIG_LIMIT 30
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6990
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6991
#if defined(SIGPOLL) && !defined(SIGIO)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6992
# define SIGIO SIGPOLL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6993
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6994
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6995
#ifdef SIGCHLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6996
# define CHILD_SIGNAL   SIGCHLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6997
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6998
# ifdef SIGCLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6999
#  define CHILD_SIGNAL  SIGCLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7000
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7001
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7002
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7003
    int sigNr;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7004
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7005
#if defined(SIGINT) || defined(SIGQUIT)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7006
# ifndef __signalUserInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7007
    extern void __signalUserInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7008
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7009
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7010
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7011
#ifdef SIGFPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7012
# ifndef __signalFpExceptionInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7013
    extern void __signalFpExceptionInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7014
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7015
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7016
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7017
#ifdef SIGIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7018
# ifndef __signalIoInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7019
    extern void __signalIoInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7020
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7021
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7022
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7023
#ifdef CHILD_SIGNAL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7024
# ifndef __signalChildInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7025
    extern void __signalChildInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7026
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7027
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7028
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7029
#ifdef SIGPIPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7030
# ifndef __signalPIPEInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7031
    extern void __signalPIPEInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7032
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7033
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7034
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7035
#ifdef SIGBUS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7036
# ifndef __signalBUSInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7037
    extern void __signalBUSInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7038
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7039
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7040
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7041
#ifdef SIGSEGV
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7042
# ifndef __signalSEGVInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7043
    extern void __signalSEGVInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7044
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7045
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7046
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7047
#if defined(SIGILL) || defined(SIGEMT)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7048
# ifndef __signalTrapInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7049
    extern void __signalTrapInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7050
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7051
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7052
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7053
#ifdef SIGALRM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7054
# ifndef WIN32
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7055
#  ifndef __signalTimerInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7056
    extern void __signalTimerInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7057
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7058
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7059
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7060
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7061
#ifndef __signalInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7062
    extern void __signalInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7063
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7064
    void (*handler)(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7065
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7066
    if (__isSmallInteger(signalNumber)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7067
     && ((sigNr = __intVal(signalNumber)) >= 0)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7068
#ifdef SIG_LIMIT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7069
     &&  (sigNr <= SIG_LIMIT)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7070
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7071
    ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7072
	/*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7073
	 * standard signals are forced into standard handlers
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7074
	 * - all others go into general signalInterrupt
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7075
	 */
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7076
#if defined(SIGPOLL) && defined(SIGIO)
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7077
	if (sigNr == SIGPOLL)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7078
	    sigNr = SIGIO;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7079
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7080
	switch (sigNr) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7081
	    case 0:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7082
		/* enabling a non-supported signal */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7083
		RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7084
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7085
#ifdef SIGBREAK
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7086
	    case SIGBREAK:
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
#ifdef SIGINT
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7089
	    case SIGINT:
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7090
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7091
#ifdef SIGQUIT
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7092
	    case SIGQUIT:
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7093
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7094
#ifdef SIGNALDEBUGWIN32
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7095
		console_printf("ConsoleSignal %d\n",sigNr);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7096
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7097
		SetConsoleCtrlHandler((PHANDLER_ROUTINE)__signalUserInterruptWIN32,TRUE);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7098
		RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7099
#ifdef SIGFPE
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7100
	    case SIGFPE:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7101
		handler = __signalFpExceptionInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7102
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7103
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7104
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7105
#ifdef SIGPIPE
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7106
	    case SIGPIPE:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7107
		handler = __signalPIPEInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7108
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7109
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7110
#ifdef SIGBUS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7111
	    case SIGBUS:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7112
		handler = __signalBUSInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7113
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7114
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7115
#ifdef SIGSEGV
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7116
	    case SIGSEGV:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7117
		handler = __signalSEGVInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7118
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7119
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7120
#ifdef SIGILL
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7121
	    case SIGILL:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7122
		handler = __signalTrapInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7123
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7124
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7125
#ifdef SIGEMT
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7126
	    case SIGEMT:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7127
		handler = __signalTrapInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7128
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7129
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7130
#ifdef SIGIO
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7131
	    case SIGIO:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7132
		handler = __signalIoInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7133
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7134
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7135
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7136
#ifdef CHILD_SIGNAL
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7137
	    case CHILD_SIGNAL:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7138
		handler = __signalChildInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7139
		break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7140
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7141
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7142
	    default:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7143
		handler = __signalInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7144
		break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7145
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7146
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7147
	{
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7148
#ifdef HAS_SIGACTION
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7149
	    struct sigaction act;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7150
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7151
	    /*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7152
	     * Do not add SA_RESTART here. A signal can cause a
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7153
	     * thread switch, another thread can do a garbage collect
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7154
	     * and restarted system calls may write into old
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7155
	     * (collected) addresses.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7156
	     */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7157
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7158
	    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
  7159
	    sigemptyset(&act.sa_mask);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7160
	    act.sa_handler = handler;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7161
	    sigaction(sigNr, &act, 0);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7162
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7163
# ifdef HAS_SIGVEC
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7164
	    struct sigvec vec;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7165
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7166
	    vec.sv_flags = SV_INTERRUPT;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7167
	    sigemptyset(&vec.sv_mask);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7168
	    vec.sv_handler = handler;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7169
	    sigvec(sigNr, &vec, NULL);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7170
# else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7171
#  ifdef WIN32
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7172
#   ifdef SIGNALDEBUGWIN32
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7173
	    console_printf("signal %d can't change handler\n",sigNr);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7174
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7175
#  else
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7176
	    (void) signal(sigNr, handler);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7177
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7178
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7179
#endif
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7180
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7181
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7182
	/*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7183
	 * maybe, we should Return the old enable-status
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7184
	 * as boolean here ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7185
	 */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7186
	RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7187
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7188
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7189
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7190
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7191
     this error is triggered on non-integer argument, or
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7192
     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
  7193
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7194
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7195
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7196
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7197
enableTimer:milliSeconds
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7198
    "setup for a timerInterrupt, to be signalled after some (real) time."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7199
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7200
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7201
    extern void __win32SetTimer();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7202
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7203
    if (__isSmallInteger(milliSeconds)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7204
	__win32SetTimer( __intVal(milliSeconds) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7205
	RETURN (true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7206
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7207
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7208
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7209
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7210
6535
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  7211
isFatalSignal:aNumber
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  7212
   "return true if a signal with number aNumber is a fatal signal,
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  7213
    i.e. some severe internal error occured"
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  7214
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  7215
   ^ (aNumber == self sigSEGV)
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  7216
     or:[aNumber == self sigILL
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  7217
     or:[aNumber == self sigBUS]]
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  7218
!
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  7219
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7220
killProcess:processId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7221
    "kill a process.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7222
     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
  7223
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7224
     WARNING: in order to avoid zombie processes (on unix),
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7225
	      you have to fetch the processes exitstatus with
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7226
	      OperatingSystem>>getStatusOfProcess:aProcessId."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7227
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7228
    self terminateProcess:processId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7229
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7230
19174
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7231
killProcessGroup:processGroupId
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7232
    "kill a process group.
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7233
     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
  7234
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7235
     WARNING: in order to avoid zombie processes (on unix),
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7236
	      you have to fetch the processes exitstatus with
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7237
	      OperatingSystem>>getStatusOfProcess:aProcessId."
19174
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7238
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7239
    self terminateProcessGroup:processGroupId
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7240
!
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7241
18414
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7242
microsecondSleep:micros
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
  7243
    "cease ANY action for some time.
18414
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7244
     This suspends the whole smalltalk (unix/windows-) process for some time.
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7245
     Not really useful since not even low-prio processes and interrupt
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7246
     handling will run during the sleep.
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7247
     Use either OperatingSystem>>millisecondDelay: (which makes all
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
  7248
     threads sleep, but handles interrupts) or use a Delay
18414
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7249
     (which makes only the calling thread sleep)."
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7250
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7251
    |uLow uHigh|
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7252
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7253
    uLow := micros // 1000000.
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7254
    uHigh := micros \\ 1000000.
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7255
%{
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7256
    struct timeval tv;
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7257
    fd_set dummy;
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7258
    int success;
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7259
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7260
    SOCKET s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7261
    FD_ZERO(&dummy);
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7262
    FD_SET(s, &dummy);
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7263
    tv.tv_sec = __intVal(uLow);
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7264
    tv.tv_usec = __intVal(uHigh);
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7265
    success = (0 == select(0, 0, 0, &dummy, &tv));
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7266
    closesocket(s);
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7267
    RETURN (success ? true : false);
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7268
%}
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7269
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7270
    "
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7271
     Timestamp now printCR.
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7272
     OperatingSystem microsecondSleep:100.
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7273
     Timestamp now printCR.
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7274
    "
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7275
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7276
    "Created: / 28-05-2015 / 14:14:53 / gg"
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7277
!
7a9f549dc84e class: Win32OperatingSystem
sr
parents: 17632
diff changeset
  7278
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7279
sendSignal:signalNumber to:processId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7280
    "send a unix signal to some process (maybe myself).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7281
     Returns false if any error occurred, true otherwise.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7282
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7283
     Do not confuse UNIX signals with Smalltalk-Signals.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7284
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7285
     WARNING: in order to avoid zombie processes (on unix),
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7286
	      you may have to fetch the processes exitstatus with
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7287
	      OperatingSystem>>getStatusOfProcess:aProcessId
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7288
	      if the signal terminates that process."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7289
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7290
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7291
    "/ either invalid argument (non-integers)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7292
    "/ or not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7293
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7294
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7295
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7296
19174
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7297
sendSignal:signalNumber to:processId toGroup:toGroupBoolean toAll:toAllBoolean
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7298
    "send a unix signal to some process (maybe myself).
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7299
     Returns false if any error occurred, true otherwise.
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7300
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7301
     Do not confuse UNIX signals with Smalltalk-Signals.
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7302
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7303
     WARNING: in order to avoid zombie processes (on unix),
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7304
	      you may have to fetch the processes exitstatus with
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7305
	      OperatingSystem>>getStatusOfProcess:aProcessId
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7306
	      if the signal terminates that process."
19174
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7307
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7308
    "/
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7309
    "/ either invalid argument (non-integers)
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7310
    "/ or not supported by OS
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7311
    "/
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7312
    ^ self primitiveFailed
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7313
!
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7314
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7315
terminateProcess:processHandleOrPid
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7316
    "terminate a process.
19174
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7317
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7318
     ATTENTION WIN32:
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7319
	 Under unix, we have terminateProcess, which does a soft
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7320
	 terminate (giving the process a chance to cleanup) and
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7321
	 killProcess, which does a hard terminate.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7322
	 Under WIN32, both (currently) use the TerminateProcess
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7323
	 function, which unconditionally causes a process to exit.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7324
	 I.e. under WIN32, the process has no chance to perform cleanup.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7325
	 Use it only in extreme circumstances. The state of
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7326
	 global data maintained by dynamic-link libraries (DLLs)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7327
	 may be compromised if TerminateProcess is used.
19174
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7328
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7329
     TODO: send a WM_QUIT instead, to allow for proper shutdown."
7065
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  7330
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7331
    self terminateProcess:processHandleOrPid exitCode:0
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7332
!
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7333
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7334
terminateProcess:processHandleOrPid exitCode:exitCode
7065
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  7335
    "terminate a process.
19174
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7336
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7337
     ATTENTION WIN32:
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7338
	 Under unix, we have terminateProcess, which does a soft
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7339
	 terminate (giving the process a chance to cleanup) and
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7340
	 killProcess, which does a hard terminate.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7341
	 Under WIN32, both (currently) use the TerminateProcess
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7342
	 function, which unconditionally causes a process to exit.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7343
	 I.e. under WIN32, the process has no chance to perform cleanup.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7344
	 Use it only in extreme circumstances. The state of
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7345
	 global data maintained by dynamic-link libraries (DLLs)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7346
	 may be compromised if TerminateProcess is used.
19174
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7347
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7348
     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
  7349
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7350
%{
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7351
    if (__isExternalAddressLike(processHandleOrPid) ) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7352
	HANDLE hProcess = _HANDLEVal(processHandleOrPid);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7353
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7354
	if (hProcess != 0) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7355
	    TerminateProcess( hProcess, __intVal(exitCode) );
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7356
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7357
	RETURN( true );
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7358
    } else if( __isSmallInteger(processHandleOrPid) ) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7359
	HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, 0, __smallIntegerVal(processHandleOrPid));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7360
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7361
	if( hProcess != 0 ) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7362
	    TerminateProcess( hProcess, __intVal(exitCode) );
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7363
	    CloseHandle(hProcess);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7364
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7365
	RETURN( true );
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7366
    }
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7367
%}.
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7368
    self primitiveFailed:#invalidParameter.
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7369
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7370
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7371
    "Modified: / 28.12.1995 / 15:05:37 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7372
    "Modified: / 27.1.1998 / 20:05:47 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7373
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7374
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7375
terminateProcessGroup:processGroupHandleOrPid
19174
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7376
    "terminate a process group (that is all subprocesses of a process).
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7377
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7378
     ATTENTION WIN32:
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7379
	 Under unix, we have terminateProcess, which does a soft
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7380
	 terminate (giving the process a chance to cleanup) and
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7381
	 killProcess, which does a hard terminate.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7382
	 Under WIN32, both (currently) use the TerminateProcess
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7383
	 function, which unconditionally causes a process to exit.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7384
	 I.e. under WIN32, the process has no chance to perform cleanup.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7385
	 Use it only in extreme circumstances. The state of
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7386
	 global data maintained by dynamic-link libraries (DLLs)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7387
	 may be compromised if TerminateProcess is used.
19174
803569fe8891 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19020
diff changeset
  7388
     TODO: send a WM_QUIT instead, to allow for proper shutdown."
14832
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  7389
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  7390
    | pid list groupsToTerminate anyMore |
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7391
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7392
    list := self getAllProcesses.
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7393
    list size == 0 ifTrue:[^ self ].
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7394
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7395
    processGroupHandleOrPid isInteger ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7396
	pid := processGroupHandleOrPid
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7397
    ] ifFalse:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7398
	pid := processGroupHandleOrPid pid.
14832
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  7399
    ].
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  7400
    groupsToTerminate := Set with:pid.
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  7401
    list := list asSet.
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  7402
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  7403
    "/ Transcript show:'terminate group '; showCR:pid.
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  7404
    anyMore := true.
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  7405
    [anyMore] whileTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7406
	anyMore := false.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7407
	list doWithExit:[:anOSProcess :exit |
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7408
	    |pid|
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7409
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7410
	    (groupsToTerminate includes:anOSProcess parentPid) ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7411
		pid := anOSProcess pid.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7412
		groupsToTerminate add:pid.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7413
		"/ Transcript show:'terminate '; showCR:pid.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7414
		self terminateProcess:( pid ).
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7415
		list remove:anOSProcess.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7416
		anyMore := true.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7417
		"/ need to restart: we have removed an element inside the loop
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7418
		exit value:nil
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7419
	    ].
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  7420
	].
14832
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  7421
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7422
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7423
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7424
!Win32OperatingSystem class methodsFor:'ipc support'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7425
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7426
makePipe
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7427
    "make a pipe, return array with two filedescriptors on success,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7428
     nil on failure.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7429
     This is a lowLevel entry, not for public use.
12686
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7430
     See NonPositionableExternalStream>>makePipe for a more user-friendly, public interface."
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7431
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7432
    |fd1 fd2 error|
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7433
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7434
%{
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7435
    HANDLE   pipeRead  = (HANDLE)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7436
    HANDLE   pipeWrite = (HANDLE)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7437
8667
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  7438
    SECURITY_ATTRIBUTES sa;
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  7439
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  7440
    ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES));
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  7441
    sa.nLength = sizeof(SECURITY_ATTRIBUTES);
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  7442
    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
  7443
    // 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
  7444
    sa.bInheritHandle = FALSE;
8667
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  7445
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  7446
    if( ! CreatePipe( &pipeRead, &pipeWrite, &sa, 0 ) ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7447
	@global(LastErrorNumber) = error = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7448
	goto out;
12686
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7449
    }
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7450
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7451
#if 1
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7452
    fd1 = __MKEXTERNALADDRESS(pipeRead);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7453
    fd2 = __MKEXTERNALADDRESS(pipeWrite);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7454
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7455
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7456
     * make fileDescriptors from handles
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7457
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7458
# ifdef PROCESSDEBUGWIN32
10352
f2e9bb8906db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10342
diff changeset
  7459
    console_printf("piperead %x\n",pipeRead);
f2e9bb8906db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10342
diff changeset
  7460
    console_printf("pipewrite %x\n",pipeWrite);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7461
# endif
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7462
    fd1 = __mkSmallInteger(_open_osfhandle(pipeRead, O_BINARY));
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7463
    fd2 = __mkSmallInteger(_open_osfhandle(pipeWrite, O_BINARY));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7464
#endif
12686
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7465
out:;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7466
%}.
10627
bef737d1b8a7 care for -1 fd returned by CreatePipe
Claus Gittinger <cg@exept.de>
parents: 10622
diff changeset
  7467
    (fd1 notNil and:[fd2 notNil]) ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7468
	(fd1 ~~ -1 and:[fd2 ~~ -1]) ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7469
	    ^ Array with:fd1 with:fd2.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7470
	].
12686
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7471
    ].
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7472
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7473
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7474
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7475
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7476
!Win32OperatingSystem class methodsFor:'misc'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7477
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7478
closePid:pid
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7479
    "free pid resource"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7480
%{
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  7481
    if (__isExternalAddressLike(pid) ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7482
	HANDLE __pid = _HANDLEVal(pid);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7483
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7484
	if (__pid != 0) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7485
#ifdef PROCESSDEBUGWIN32
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7486
	    console_printf("Close ProcessHandle %x\n", __pid);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7487
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7488
	    CloseHandle(__pid);
14636
26765f6a6b11 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
  7489
	    _SETHANDLEVal(pid, 0);
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7490
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7491
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7492
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7493
    ^ true.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7494
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7495
    "Created: 28.1.1998 / 14:23:04 / md"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7496
    "Modified: 28.1.1998 / 14:27:18 / md"
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7497
!
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7498
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7499
duplicateHandle:aHandle to:targetProcessHandle
14520
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7500
    |hMe spaceForTargetHandle rslt addr|
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7501
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7502
    spaceForTargetHandle := ExternalLong unprotectedNew.
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7503
    hMe := self getCurrentProcess.
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  7504
    rslt := self
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  7505
		primDuplicateHandle_hSourcProcessHandle:hMe
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  7506
		hSourceHandle:aHandle
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  7507
		hTargetProcesshandle:targetProcessHandle ? hMe
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  7508
		lpTargetHandle:spaceForTargetHandle
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  7509
		dwDesiredAccess:0
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  7510
		bInheritHandle:false
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  7511
		dwOptions:2 "DUPLICATE_SAME_ACCESS".
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7512
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7513
    rslt ifFalse:[
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  7514
	spaceForTargetHandle free.
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  7515
	self primitiveFailed:self primGetLastError.
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  7516
	^ nil
14520
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7517
    ].
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7518
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7519
    addr := spaceForTargetHandle value.
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7520
    spaceForTargetHandle free.
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7521
    ^ ExternalAddress newAddress:addr.
10720
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
    "Created: / 18-09-2007 / 16:34:25 / cg"
14520
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7524
    "Modified: / 21-11-2012 / 12:14:06 / anwild"
10720
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
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7527
getAllProcesses
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7528
    "answer a sequence of OSProcess, all processes running in system"
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7529
15546
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  7530
    |list st_perProc f|
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7531
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7532
    list := OrderedCollection new.
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7533
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7534
%{
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7535
#ifdef TLHELP32_H_INCLUDE
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7536
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7537
    HANDLE hProcessSnap;
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7538
    PROCESSENTRY32 pe32;
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7539
    hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7540
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7541
    if( hProcessSnap != INVALID_HANDLE_VALUE ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7542
	pe32.dwSize = sizeof(PROCESSENTRY32);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7543
	Process32First( hProcessSnap, & pe32 );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7544
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7545
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7546
	    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
  7547
	    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
  7548
	    __SSEND1(st_perProc, @symbol(commandLine:), 0, f );
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7549
	    __SSEND1(st_perProc, @symbol(pid:), 0, __mkSmallInteger(pe32.th32ProcessID) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7550
	    __SSEND1(st_perProc, @symbol(parentPid:), 0, __mkSmallInteger(pe32.th32ParentProcessID) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7551
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7552
	    __SSEND1(list, @symbol(add:), 0, st_perProc );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7553
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7554
	while(Process32Next(hProcessSnap,&pe32));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7555
	CloseHandle( hProcessSnap );
13128
35def02e40f4 CloseHandle added in: getAllProcesses
Michael Beyl <mb@exept.de>
parents: 13114
diff changeset
  7556
    }
35def02e40f4 CloseHandle added in: getAllProcesses
Michael Beyl <mb@exept.de>
parents: 13114
diff changeset
  7557
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7558
#endif  /* TLHELP32_H_INCLUDE */
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7559
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7560
%}.
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7561
    ^ list
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7562
!
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7563
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7564
getCurrentProcess
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7565
    <apicall: handle "GetCurrentProcess" ( ) module: "kernel32.dll" >
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7566
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7567
    "
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7568
     self getCurrentProcess
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7569
    "
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7570
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7571
    "Created: / 18-09-2007 / 16:32:22 / cg"
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7572
!
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7573
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  7574
getPrivateProfileString:appNameString key:keyNameString default:defaultString fileName:fileName
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7575
    ^ self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7576
	getProfileString:appNameString key:keyNameString default:defaultString
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7577
	fileName:fileName private:true
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7578
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7579
    "Modified: / 27-07-2006 / 11:57:03 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7580
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7581
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  7582
getProfileString:appNameString key:keyNameString default:defaultString
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7583
%{
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7584
    char *__appNameString = NULL;
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7585
    char *__keyNameString = NULL;
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7586
    char *__defaultString = NULL;
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7587
    char *__returnedString = NULL;
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7588
    char quickBuffer[1024];
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7589
    char *usedBuffer = quickBuffer;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7590
    int bufferSize = sizeof(quickBuffer);
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7591
    int nChars;
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7592
    OBJ retVal;
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7593
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  7594
    if (__isStringLike(appNameString)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7595
	__appNameString = __stringVal(appNameString);
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7596
    } else if (appNameString != nil)
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7597
	goto primitiveFail;
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7598
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  7599
    if (__isStringLike(keyNameString)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7600
	__keyNameString = __stringVal(keyNameString);
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7601
    } else if (keyNameString != nil)
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7602
	goto primitiveFail;
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7603
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  7604
    if (__isStringLike(defaultString)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7605
	__defaultString = __stringVal(defaultString);
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7606
    } else if (defaultString != nil)
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7607
	goto primitiveFail;
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7608
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7609
    do {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7610
	nChars = GetProfileString(__appNameString, __keyNameString, __defaultString, usedBuffer, bufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7611
	if (nChars >= 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7612
	    if (nChars != bufferSize-1) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7613
		retVal = __MKSTRING_L(usedBuffer, nChars);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7614
		if (usedBuffer != quickBuffer) free(usedBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7615
		RETURN (retVal);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7616
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7617
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7618
	    {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7619
		/* use a bigger buffer */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7620
		char *newBuffer;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7621
		int newBufferSize = bufferSize * 2;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7622
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7623
		newBuffer = (char *)malloc( newBufferSize );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7624
		if (usedBuffer != quickBuffer) free(usedBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7625
		usedBuffer = newBuffer;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7626
		bufferSize = newBufferSize;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7627
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7628
	}
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  7629
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7630
    } while (nChars > 0);
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7631
    RETURN (nil);
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7632
  primitiveFail: ;
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7633
%}.
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7634
    self primitiveFailed
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7635
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7636
    "Created: / 27-07-2006 / 11:54:59 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7637
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7638
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7639
getProfileString:appNameString key:keyNameString default:defaultString fileName:fileName private:private
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7640
%{
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7641
    char *__appNameString = NULL;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7642
    char *__keyNameString = NULL;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7643
    char *__defaultString = NULL;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7644
    char *__returnedString = NULL;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7645
    char *__fileName = NULL;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7646
    char quickBuffer[1024];
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7647
    char *usedBuffer = quickBuffer;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7648
    int bufferSize = sizeof(quickBuffer);
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7649
    int nChars;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7650
    OBJ retVal;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7651
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  7652
    if (__isStringLike(appNameString)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7653
	__appNameString = __stringVal(appNameString);
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7654
    } else if (appNameString != nil)
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7655
	goto primitiveFail;
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7656
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  7657
    if (__isStringLike(keyNameString)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7658
	__keyNameString = __stringVal(keyNameString);
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7659
    } else if (keyNameString != nil)
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7660
	goto primitiveFail;
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7661
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  7662
    if (__isStringLike(defaultString)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7663
	__defaultString = __stringVal(defaultString);
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7664
    } else if (defaultString != nil)
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7665
	goto primitiveFail;
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7666
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7667
    if (private == true) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7668
	if (! __isStringLike(fileName)) goto primitiveFail;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7669
	__fileName = __stringVal(fileName);
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7670
    }
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7671
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7672
    do {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7673
	if (private == true) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7674
	    nChars = GetPrivateProfileString(__appNameString, __keyNameString, __defaultString, usedBuffer, bufferSize, __fileName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7675
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7676
	    nChars = GetProfileString(__appNameString, __keyNameString, __defaultString, usedBuffer, bufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7677
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7678
	if (nChars >= 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7679
	    if (nChars != bufferSize-1) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7680
		retVal = __MKSTRING_L(usedBuffer, nChars);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7681
		if (usedBuffer != quickBuffer) free(usedBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7682
		RETURN (retVal);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7683
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7684
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7685
	    {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7686
		/* use a bigger buffer */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7687
		char *newBuffer;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7688
		int newBufferSize = bufferSize * 2;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7689
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7690
		newBuffer = (char *)malloc( newBufferSize );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7691
		if (usedBuffer != quickBuffer) free(usedBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7692
		usedBuffer = newBuffer;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7693
		bufferSize = newBufferSize;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7694
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7695
	}
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  7696
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7697
    } while (nChars > 0);
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7698
    RETURN (nil);
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7699
  primitiveFail: ;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7700
%}.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7701
    self primitiveFailed
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7702
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7703
    "Created: / 27-07-2006 / 11:55:25 / fm"
10274
a90d2c9d04b0 writePrivateProfileString
fm
parents: 10180
diff changeset
  7704
!
a90d2c9d04b0 writePrivateProfileString
fm
parents: 10180
diff changeset
  7705
10615
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7706
hInstance
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7707
    "very Win32 specific: get the HINSTANCE of the executable"
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7708
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7709
%{
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7710
    extern void *__getHInstance();
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7711
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7712
    RETURN (__MKEXTERNALADDRESS(__getHInstance()));
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7713
%}
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7714
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7715
    "
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7716
     Win32OperatingSystem hInstance
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7717
    "
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7718
!
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7719
16279
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7720
isValidHandle:anExternalAddress
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7721
    |newHandle|
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7722
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7723
    newHandle := self duplicateHandle:anExternalAddress to:nil.
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7724
    newHandle isNil ifTrue:[
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
  7725
	^ false.
16279
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7726
    ].
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7727
"/    self closeHandle:newHandle.
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7728
    ^ true.
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7729
!
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7730
11767
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7731
playSound:fileName
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7732
    self playSound:fileName mode:1
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7733
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7734
"/#define SND_SYNC            0x0000  /* play synchronously (default) */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7735
"/#define SND_ASYNC           0x0001  /* play asynchronously */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7736
"/#define SND_NODEFAULT       0x0002  /* silence (!!default) if sound not found */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7737
"/#define SND_LOOP            0x0008  /* loop the sound until next sndPlaySound */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7738
"/#define SND_NOSTOP          0x0010  /* don't stop any currently playing sound */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7739
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7740
    "
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7741
     self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7742
	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
  7743
    "
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7744
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7745
    "Created: / 06-11-2007 / 00:46:57 / cg"
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7746
!
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7747
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7748
playSound:fileName mode:modeInteger
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7749
    <apicall: void "sndPlaySoundA" ( lpstr uint32) module: "winmm.dll" >
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7750
    self primitiveFailed.
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7751
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7752
"/#define SND_SYNC            0x0000  /* play synchronously (default) */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7753
"/#define SND_ASYNC           0x0001  /* play asynchronously */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7754
"/#define SND_NODEFAULT       0x0002  /* silence (!!default) if sound not found */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7755
"/#define SND_LOOP            0x0008  /* loop the sound until next sndPlaySound */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7756
"/#define SND_NOSTOP          0x0010  /* don't stop any currently playing sound */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7757
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7758
    "
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7759
     self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7760
	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
  7761
	mode:1
11767
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7762
    "
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7763
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7764
    "Modified: / 06-11-2007 / 00:46:27 / cg"
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7765
!
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7766
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7767
primCloseHandle: handle
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7768
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7769
    <apicall: ulongReturn "CloseHandle" ( handle ) module: "kernel32.dll" >
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7770
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7771
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  7772
primDuplicateHandle_hSourcProcessHandle:hSourceProcess
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7773
    hSourceHandle:hSourceHandle
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  7774
    hTargetProcesshandle:hTargetProcessHandle
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  7775
    lpTargetHandle:lpTargetHandle
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7776
    dwDesiredAccess:desiredAccess
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  7777
    bInheritHandle:bInheritHandle
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7778
    dwOptions:dwOptions
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7779
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7780
    <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
  7781
    self primitiveFailed.
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7782
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7783
    "Created: / 18-09-2007 / 16:31:23 / cg"
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7784
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7785
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7786
primGetLastError
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7787
%{  /* NOCONTEXT */
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7788
    DWORD e;
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7789
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7790
    e = GetLastError();
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7791
    RETURN(__MKUINT(e));
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7792
%}.
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7793
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7794
    "/ <apicall: dword "GetLastError" () module: "kernel32.dll" >
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7795
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7796
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7797
	self primGetLastError
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7798
    "
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7799
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7800
15338
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7801
primSetLastError: i
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7802
%{  /* NOCONTEXT */
15338
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7803
    if (__isSmallInteger(i)) {
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7804
	SetLastError(__intVal(i));
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7805
	RETURN(self);
15338
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7806
    }
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7807
%}.
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7808
    self primitiveFailed.
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7809
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7810
   "/ <apicall: void "SetLastError" (dword) module: "kernel32.dll" >
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7811
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7812
    "
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7813
	self primSetLastError: 0
11089
a6f47ff0561a mutex fix
fm
parents: 11088
diff changeset
  7814
    "
a6f47ff0561a mutex fix
fm
parents: 11088
diff changeset
  7815
!
a6f47ff0561a mutex fix
fm
parents: 11088
diff changeset
  7816
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7817
primWritePrivateProfileString: appName keyName: keyName profileString: profString fileName: aString
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7818
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7819
    <apicall: bool "WritePrivateProfileStringA" ( lpstr lpstr lpstr lpstr ) module: "Kernel32.dll" >
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7820
    ^self primitiveFailed
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7821
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7822
    "Created: / 18-12-2006 / 13:01:41 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7823
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7824
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7825
writePrivateProfileString: appName keyName: keyName profileString: profString fileName: aString
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7826
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7827
   ^self primWritePrivateProfileString: appName keyName: keyName profileString: profString fileName: aString
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7828
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7829
"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7830
    |profileStringToWrite recoveredProfileString|
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7831
    profileStringToWrite :=  'c:\vsw311'.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7832
    self writePrivateProfileString: 'PAV-Editor' keyName: 'ExportPath' profileString: profileStringToWrite fileName: 'C:\vsw311\dapas.ini'.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7833
    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
  7834
    self assert: (profileStringToWrite = recoveredProfileString).
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7835
"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7836
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7837
    "Modified: / 18-12-2006 / 13:20:20 / User"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7838
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7839
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7840
!Win32OperatingSystem class methodsFor:'mutex'!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7841
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7842
createMutexNamed: name
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7843
    "Returns an array with the handle and the lastErrorCode"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7844
11089
a6f47ff0561a mutex fix
fm
parents: 11088
diff changeset
  7845
    |handle lastErrorCode|
a6f47ff0561a mutex fix
fm
parents: 11088
diff changeset
  7846
12986
bd31df28e32a changed: #createMutexNamed:
Claus Gittinger <cg@exept.de>
parents: 12970
diff changeset
  7847
    "/ "Without clear reasons, before creating the mutex we must call #printCR"
bd31df28e32a changed: #createMutexNamed:
Claus Gittinger <cg@exept.de>
parents: 12970
diff changeset
  7848
    "/ 'Creating mutex' printCR.
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7849
    self primSetLastError: 0.
11092
a05bd545f00d mutex fix
fm
parents: 11091
diff changeset
  7850
    self primGetLastError.
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7851
    handle := self primCreateMutex:nil initialOwner: true name: name.
11089
a6f47ff0561a mutex fix
fm
parents: 11088
diff changeset
  7852
    lastErrorCode := self primGetLastError.
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7853
    "/ lastErrorCode printCR.
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7854
11092
a05bd545f00d mutex fix
fm
parents: 11091
diff changeset
  7855
"/    self assert: lastErrorCode == 0.
11342
3a99bfdee484 changed #createMutexNamed:
fm
parents: 11291
diff changeset
  7856
"/    lastErrorCode == 5 "ERROR_ACCESS_DENIED" ifTrue:[Transcript showCR: 'Mutex not accesible (GetLastError = ERROR_ACCESS_DENIED)'.].
3a99bfdee484 changed #createMutexNamed:
fm
parents: 11291
diff changeset
  7857
"/    lastErrorCode == 183 "ERROR_ALREADY_EXISTS" ifTrue:[Transcript showCR: 'Mutex already exists (GetLastError = ERROR_ALREADY_EXISTS)'.].
11088
31c6b3e16450 mutex fix3
fm
parents: 11087
diff changeset
  7858
    (handle isNil or:[handle address ~~ 0]) ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7859
	Transcript showCR: 'CreateMutexNamed: "', name printString, '" failed'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7860
	handle := nil.
11342
3a99bfdee484 changed #createMutexNamed:
fm
parents: 11291
diff changeset
  7861
    ].
3a99bfdee484 changed #createMutexNamed:
fm
parents: 11291
diff changeset
  7862
    ^ Array with: handle with: lastErrorCode
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7863
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7864
    "
12986
bd31df28e32a changed: #createMutexNamed:
Claus Gittinger <cg@exept.de>
parents: 12970
diff changeset
  7865
     self createMutexNamed: '8906f5e0-54ed-11dd-9da4-001558137da0'
bd31df28e32a changed: #createMutexNamed:
Claus Gittinger <cg@exept.de>
parents: 12970
diff changeset
  7866
     self releaseMutexNamed: '8906f5e0-54ed-11dd-9da4-001558137da0'
bd31df28e32a changed: #createMutexNamed:
Claus Gittinger <cg@exept.de>
parents: 12970
diff changeset
  7867
    "
bd31df28e32a changed: #createMutexNamed:
Claus Gittinger <cg@exept.de>
parents: 12970
diff changeset
  7868
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7869
    "Modified: / 03-08-2010 / 16:57:36 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7870
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7871
11086
4c10b9d1ce49 mutex fix
fm
parents: 11085
diff changeset
  7872
existsMutexNamed: name
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7873
    |handle lastErrorCode handleAndLastErrorCode|
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7874
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7875
    handleAndLastErrorCode := self createMutexNamed: name.
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7876
    handle := handleAndLastErrorCode first.
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7877
    lastErrorCode := handleAndLastErrorCode second.
11092
a05bd545f00d mutex fix
fm
parents: 11091
diff changeset
  7878
"/    self assert: lastErrorCode == 0.
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7879
    ^ handle isNil
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7880
	or:[lastErrorCode == 183 "ERROR_ALREADY_EXISTS"
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7881
	    or:[ lastErrorCode == 5 "ERROR_ACCESS_DENIED"]]
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7882
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7883
    "Modified: / 03-08-2010 / 16:59:41 / cg"
11086
4c10b9d1ce49 mutex fix
fm
parents: 11085
diff changeset
  7884
!
4c10b9d1ce49 mutex fix
fm
parents: 11085
diff changeset
  7885
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7886
openMutexNamed: name
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7887
    "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
  7888
     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
  7889
     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
  7890
11088
31c6b3e16450 mutex fix3
fm
parents: 11087
diff changeset
  7891
    |handle |
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7892
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7893
    handle := self primOpenMutex:nil initialOwner: true name: name.
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7894
"/    lastErrorCode := self primGetLastError.
11088
31c6b3e16450 mutex fix3
fm
parents: 11087
diff changeset
  7895
"/    lastErrorCode = 2 ifTrue:[Transcript showCR: 'Mutex does not exist (GetLastError = ERROR_FILE_NOT_FOUND)'.].
31c6b3e16450 mutex fix3
fm
parents: 11087
diff changeset
  7896
"/    lastErrorCode = 5 ifTrue:[Transcript showCR: 'Mutex not accesible (GetLastError = ERROR_ACCESS_DENIED)'.].
31c6b3e16450 mutex fix3
fm
parents: 11087
diff changeset
  7897
    (handle isNil or:[handle address ~~ 0]) ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7898
	Transcript showCR: 'OpenMutexNamed: "', name printString, '" failed'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7899
	^ nil.
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7900
    ].
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7901
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7902
    ^ handle
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7903
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7904
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7905
    "
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7906
    self openMutexNamed: '8906f5e0-54ed-11dd-9da4-001558137da0'
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7907
    "
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7908
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7909
    "Modified: / 03-08-2010 / 16:59:37 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7910
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7911
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7912
primCreateMutex:lpSecurityDescriptor initialOwner: bInitialOwner name: lpName
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7913
    "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
  7914
     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
  7915
     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
  7916
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7917
    <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
  7918
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7919
    "Modified: / 03-08-2010 / 16:59:26 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7920
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7921
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7922
primOpenMutex:lpSecurityDescriptor initialOwner: bInitialOwner name: lpName
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7923
    "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
  7924
     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
  7925
     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
  7926
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7927
    <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
  7928
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7929
    "Modified: / 03-08-2010 / 16:59:11 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7930
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7931
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7932
primReleaseMutex: hMutex
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7933
    "If the function succeeds, the return value is nonzero.
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7934
     If the function fails, the return value is zero."
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7935
11085
ff0e28fd7027 changed #primReleaseMutex:
fm
parents: 11084
diff changeset
  7936
    <apicall: bool "ReleaseMutex" (handle) module: "kernel32.dll" >
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7937
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7938
    "Modified: / 03-08-2010 / 16:59:55 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7939
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7940
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7941
primWaitForSingleObject: handle milliseconds: dwMilliseconds
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7942
    "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
  7943
     If the function fails, the return value is WAIT_FAILED ((DWORD)0xFFFFFFFF)."
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7944
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7945
    <apicall: dword "WaitForSingleObject" (handle dword) module: "kernel32.dll" >
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7946
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7947
    "Modified: / 03-08-2010 / 17:00:02 / cg"
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7948
!
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7949
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7950
releaseMutex: hMutex
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7951
    "Returns true if the Mutex was released. Otherwise, returns false."
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7952
11085
ff0e28fd7027 changed #primReleaseMutex:
fm
parents: 11084
diff changeset
  7953
    | released|
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7954
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7955
    hMutex isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7956
	Transcript showCR: 'hMutex is nil - cannot release'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7957
	^ false
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7958
    ].
11085
ff0e28fd7027 changed #primReleaseMutex:
fm
parents: 11084
diff changeset
  7959
    released := self primReleaseMutex: hMutex.
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7960
    released ifFalse:[Transcript showCR: 'Release Mutex failed'.].
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7961
    ^ released
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7962
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7963
    "Modified: / 03-08-2010 / 17:00:05 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7964
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7965
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7966
releaseMutexNamed: name
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7967
    "Returns true if the Mutex was released. Otherwise, returns false."
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7968
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7969
    | hMutex |
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7970
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7971
    hMutex := self openMutexNamed: name.
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7972
    hMutex isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7973
	Transcript showCR: 'Cannot release Mutex named: "', name printString,'"'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7974
	^ false
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7975
    ].
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7976
    ^ self releaseMutex: hMutex.
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7977
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7978
    "Modified: / 03-08-2010 / 16:58:25 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7979
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7980
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7981
waitForSingleObject: handle
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7982
    |result|
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7983
11092
a05bd545f00d mutex fix
fm
parents: 11091
diff changeset
  7984
    result := self primWaitForSingleObject: handle milliseconds: 500.
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7985
    ^ result
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7986
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7987
    "Modified: / 03-08-2010 / 17:00:10 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7988
! !
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7989
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7990
!Win32OperatingSystem class methodsFor:'network resources'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7991
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7992
networkResourceAccessor
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7993
    "answer the Win32NetworkResourceHandle or nil if not supported"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7994
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7995
    ^ Win32NetworkResourceHandle
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7996
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7997
19499
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  7998
!Win32OperatingSystem class methodsFor:'notifications'!
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  7999
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  8000
createChangeNotificationHandleFor:aDirectoryPathName flags:changeFlags
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  8001
    |handle|
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  8002
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  8003
    handle := Win32ChangeNotificationHandle new.
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  8004
%{
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  8005
    if (__isString(aDirectoryPathName)
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  8006
     && __isSmallInteger(changeFlags)) {
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8007
	char *__dirName = __stringVal(aDirectoryPathName);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8008
	INT __flags = __intVal(changeFlags);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8009
	HANDLE __changeHandle;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8010
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8011
	__changeHandle = FindFirstChangeNotification(__dirName, FALSE, __flags);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8012
	if (__changeHandle == INVALID_HANDLE_VALUE) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8013
	    console_printf("failed to create handle\n");
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8014
	} else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8015
	    __externalAddressVal(handle) = __changeHandle;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8016
	    RETURN (handle);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8017
	}
19499
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  8018
    }
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  8019
%}.
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  8020
    self primitiveFailed
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  8021
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  8022
    "
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8023
	|h|
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8024
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8025
	[
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8026
	    h := OperatingSystem createChangeNotificationHandleFor:'.'
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8027
		flags:(FILE_NOTIFY_CHANGE_FILE_NAME  |
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8028
		       FILE_NOTIFY_CHANGE_DIR_NAME |
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8029
		       FILE_NOTIFY_CHANGE_ATTRIBUTES |
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8030
		       FILE_NOTIFY_CHANGE_SIZE |
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8031
		       FILE_NOTIFY_CHANGE_LAST_WRITE).
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8032
	    Transcript showCR:'waiting...'.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8033
	    OperatingSystem waitForSingleObject:h withTimeout:1000.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8034
	    Transcript showCR:'got a change...'.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8035
	    h close.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8036
	] fork.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8037
	Delay waitForSeconds:0.25.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8038
	Transcript showCR:'changing...'.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
  8039
	'./bla' asFilename contents:'hello'.
19499
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  8040
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  8041
    "
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  8042
! !
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
  8043
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8044
!Win32OperatingSystem class methodsFor:'os queries'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8045
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8046
executableFileExtensions
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8047
    "return a collection of extensions for executable program files.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8048
     Only req'd for msdos like systems ..."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8049
13616
69b0892613ed changed: #executableFileExtensions
Claus Gittinger <cg@exept.de>
parents: 13583
diff changeset
  8050
    ^ #('com' 'exe' 'bat')
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8051
13618
9af72c855037 Fixes for #canExecuteCommand:
vrany
parents: 13616
diff changeset
  8052
    "Created: / 02-05-1997 / 11:42:29 / cg"
9af72c855037 Fixes for #canExecuteCommand:
vrany
parents: 13616
diff changeset
  8053
    "Modified: / 23-08-2011 / 21:14:45 / jv"
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
20245
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8056
expandEnvironmentStrings:aString
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8057
    "expand the environmentStrings (e.g. %ProgramFiles%) in aString"
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8058
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8059
    |count resultString resultCount|
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8060
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8061
    count := aString size + 128.
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8062
    [
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8063
        aString isWideString ifTrue:[
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8064
            resultString := Unicode16String new:count.
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8065
            resultCount := self primExpandEnvironmentStringsW:aString into:resultString size:count.
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8066
        ] ifFalse:[
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8067
            resultString := String new:count.
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8068
            resultCount := self primExpandEnvironmentStringsA:aString into:resultString size:count.
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8069
        ].
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8070
        resultCount <= count ifTrue:[
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8071
            true
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8072
        ] ifFalse:[
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8073
            "resultString was too small. resultCount is the required buffer size"
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8074
            count := resultCount.
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8075
            false
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8076
        ].
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8077
    ] whileFalse.
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8078
    ^ resultString copyTo:resultCount-1.
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8079
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8080
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8081
    "
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8082
        self expandEnvironmentStrings:'%ProgramFiles%\test\x'
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8083
        self expandEnvironmentStrings:'%ProgramFiles%\test\x' asUnicode16String
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8084
    "
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8085
!
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
  8086
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8087
getDomainName
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8088
    "return the DNS domain this host is in.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8089
     Notice:
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8090
	not all systems support this; on some, 'unknown' is returned."
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8091
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8092
    |domainName idx hostName k|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8093
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8094
    DomainName notNil ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8095
	^ DomainName
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8096
    ].
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8097
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8098
    "/ sometimes, we can extract the domainName from the hostName ...
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8099
    hostName := self getHostName.
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8100
    hostName notEmptyOrNil ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8101
	idx := hostName indexOf:$..
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8102
	idx ~~ 0 ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8103
	    domainName := hostName copyFrom:idx+1.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8104
	]
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8105
    ].
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8106
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8107
    domainName isNil ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8108
	domainName := self getEnvironment:'DOMAIN'.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8109
	domainName isNil ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8110
	    domainName := self getEnvironment:'DOMAINNAME'.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8111
	].
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8112
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8113
	domainName isNil ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8114
	    "/ ok, search the registry ...
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8115
	    "/ under NT and later, it is found there ...
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8116
	    k := RegistryEntry key:'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters'.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8117
	    k notNil ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8118
		domainName := k valueNamed:'Domain'.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8119
		k close.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8120
	    ].
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8121
	].
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8122
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8123
	domainName isNil ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8124
	    ^ 'unknown'.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8125
	].
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8126
	DomainName := domainName.     "cache only, if it is fixed"
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8127
    ].
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8128
    ^ domainName
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8129
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8130
    "
8659
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  8131
     DomainName := nil.
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  8132
     OperatingSystem getDomainName
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8133
     OperatingSystem getHostName
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8134
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8135
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8136
    "Modified: 26.4.1996 / 10:04:54 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8137
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8138
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8139
getEnvironment:aStringOrSymbol
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8140
    "get an environment string"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8141
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8142
%{  /* NOCONTEXT */
19284
a8e9068d61bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19282
diff changeset
  8143
#   define ENV_BUFSIZE 2048
a8e9068d61bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19282
diff changeset
  8144
    WCHAR _varName[ENV_BUFSIZE];
a8e9068d61bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19282
diff changeset
  8145
    WCHAR buff[ENV_BUFSIZE];
18962
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8146
    int nNeeded;
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8147
    OBJ ret = nil;
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8148
    int i, l;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8149
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  8150
    if (__isStringLike(aStringOrSymbol)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8151
	l = __stringSize(aStringOrSymbol);
19285
da9a76755850 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19284
diff changeset
  8152
	if (l > ENV_BUFSIZE-1)
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8153
	    goto badArgument;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8154
	for (i=0; i<l; i++) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8155
	    _varName[i] = __stringVal(aStringOrSymbol)[i];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8156
	}
18962
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8157
    } else if (__isUnicode16String(aStringOrSymbol)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8158
	l = __unicode16StringSize(aStringOrSymbol);
19285
da9a76755850 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19284
diff changeset
  8159
	if (l > ENV_BUFSIZE-1)
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8160
	    goto badArgument;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8161
	for (i=0; i<l; i++) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8162
	    _varName[i] = __unicode16StringVal(aStringOrSymbol)[i];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8163
	}
19285
da9a76755850 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19284
diff changeset
  8164
    } else {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8165
	goto badArgument;
19285
da9a76755850 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19284
diff changeset
  8166
    }
18962
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8167
    _varName[l] = 0;
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8168
19284
a8e9068d61bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19282
diff changeset
  8169
    nNeeded = GetEnvironmentVariableW(_varName, buff, ENV_BUFSIZE);
18962
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8170
    if (nNeeded > sizeof(buff)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8171
	WCHAR *buff2;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8172
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8173
	buff2 = (char *)malloc(nNeeded * sizeof(WCHAR));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8174
	GetEnvironmentVariableW(_varName, buff2, nNeeded);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8175
	ret = __mkStringOrU16String_maxlen(buff2, nNeeded);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8176
	free(buff2);
18962
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8177
    } else if (nNeeded > 0) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8178
	ret = __mkStringOrU16String_maxlen(buff, nNeeded);
19284
a8e9068d61bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19282
diff changeset
  8179
	// console_printf("getenv() -> %"_lx_"\n", (INT)ret);
18962
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8180
    }
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8181
    RETURN (ret);
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8182
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8183
badArgument:;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8184
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8185
.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8186
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8187
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8188
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8189
     OperatingSystem getEnvironment:'PATH'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8190
    "
10294
f9fd95f04653 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10287
diff changeset
  8191
10297
d93eeb6c92eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10294
diff changeset
  8192
    "Modified: / 09-01-2007 / 20:14:35 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8193
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8194
8659
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  8195
getHostName
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8196
    "return the hostname we are running on
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8197
      - if possible, the fully qualified host name."
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8198
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8199
    |hostName|
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8200
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8201
%{  /* STACK: 2048 */
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8202
#if defined(__MINGW32__)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8203
    char bufferA[512];
14783
93bf8545cbd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14782
diff changeset
  8204
    DWORD buffSize = sizeof(bufferA);
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8205
#else
14083
eace28be0149 changed: #getHostName
Stefan Vogel <sv@exept.de>
parents: 13956
diff changeset
  8206
    WCHAR buffer[512];
14087
6b3dea4f8fc9 changed: #getHostName
Stefan Vogel <sv@exept.de>
parents: 14083
diff changeset
  8207
    DWORD buffSize = sizeof(buffer)/sizeof(buffer[0]);
14783
93bf8545cbd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14782
diff changeset
  8208
#endif
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8209
14083
eace28be0149 changed: #getHostName
Stefan Vogel <sv@exept.de>
parents: 13956
diff changeset
  8210
    // Note: GetComputerNameExA can fail in certain locales!
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8211
#if defined(__MINGW32__)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8212
    if (GetComputerNameA(bufferA, &buffSize) == TRUE) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8213
	RETURN(__MKSTRING_L(bufferA, buffSize));
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
  8214
    }
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
  8215
#else
14083
eace28be0149 changed: #getHostName
Stefan Vogel <sv@exept.de>
parents: 13956
diff changeset
  8216
    if (GetComputerNameExW(ComputerNameDnsFullyQualified, buffer, &buffSize) == TRUE) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
  8217
	RETURN(__mkStringOrU16String_maxlen(buffer, buffSize));
18962
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8218
    }
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8219
#endif
29c5db48dd57 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18954
diff changeset
  8220
%}.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8221
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8222
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8223
     OperatingSystem getHostName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8224
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8225
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8226
7775
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  8227
getLanguage
10311
1cf7f6da9fad comment
Claus Gittinger <cg@exept.de>
parents: 10297
diff changeset
  8228
    "get the LANGUAGE setting (example: de_DE.iso8859-15@euro).
1cf7f6da9fad comment
Claus Gittinger <cg@exept.de>
parents: 10297
diff changeset
  8229
     An environment value has higher preceedence than the system language setting."
9177
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  8230
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  8231
    |lang|
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  8232
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  8233
    lang := self getEnvironment:'LANG'.
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  8234
    (lang isNil or:[lang = 'default']) ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8235
	"/ ok, search the registry ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8236
	"/ under XP, it is found there ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8237
	lang := RegistryEntry
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8238
		    stringValueFor:'sLanguage'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8239
		    atKey:'HKEY_CURRENT_USER\Control Panel\International'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8240
	lang notNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8241
	    lang := self mapLanguage:lang.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8242
	].
7775
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  8243
    ].
9177
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  8244
    ^ lang
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  8245
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  8246
    "
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  8247
     OperatingSystem getLanguage
7775
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  8248
    "
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  8249
    "Modified: 26.4.1996 / 10:04:54 / stefan"
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  8250
!
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  8251
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8252
getLocaleInfo
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8253
    "return a dictionary filled with values from the locale information;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8254
     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
  8255
     Possible fields are:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8256
	decimalPoint                    <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8257
	thousandsSep                    <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8258
	internationalCurrencySymbol     <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8259
	currencySymbol                  <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8260
	monetaryDecimalPoint            <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8261
	monetaryThousandsSeparator      <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8262
	positiveSign                    <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8263
	negativeSign                    <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8264
	internationalFractionalDigits   <Integer>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8265
	fractionalDigits                <Integer>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8266
	positiveSignPrecedesCurrencySymbol      <Boolean>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8267
	negativeSignPrecedesCurrencySymbol      <Boolean>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8268
	positiveSignSeparatedBySpaceFromCurrencySymbol  <Boolean>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8269
	negativeSignSeparatedBySpaceFromCurrencySymbol  <Boolean>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8270
	positiveSignPosition                            <Symbol>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8271
							one of: #parenthesesAround,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8272
								#signPrecedes,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8273
								#signSuceeds,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8274
								#signPrecedesCurrencySymbol,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8275
								#signSuceedsCurrencySymbol
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8276
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8277
	negativeSignPosition                            <like above>
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8278
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8279
     it is up to the application to deal with undefined values.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8280
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8281
     Notice, that (for now), the system does not use this information;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8282
     it should be used by applications as required.
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8285
    |info val|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8286
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8287
    LocaleInfo notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8288
	"/ return the internal info; useful on systems which do not
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8289
	"/ support this.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8290
	^ LocaleInfo
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8293
    info := IdentityDictionary new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8294
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8295
    char *decimalPoint;         /* something like "." (US) or "," (german) */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8296
    char *thousandsSep;         /* something like "," (US) or "." (german) */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8297
    char *intCurrencySymbol;    /* international currency symbol; something like "USD "  "DM  " */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8298
    char *currencySymbol;       /* local currency symbol;         something like "USD "  "DM  " */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8299
    char *monDecimalPoint;      /* money: decimal point */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8300
    char *monThousandsSep;      /* money: thousands sep */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8301
    char *positiveSign;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8302
    char *negativeSign;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8303
    int   intFractDigits;       /* money: international digits after decPoint */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8304
    int   fractDigits;          /* money: local digits after decPoint */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8305
    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
  8306
    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
  8307
    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
  8308
    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
  8309
    int   csPosSignPosition;    /* money: 0: ()'s around the value & currency symbol */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8310
    int   csNegSignPosition;    /*        1: sign precedes the value & currency symbol */
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8311
				/*        2: sign succeeds the value & currency symbol */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8312
				/*        3: sign immediately precedes the currency symbol */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8313
				/*        4: sign immediately suceeds the currency symbol */
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 defined(HAS_LOCALECONV)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8316
    struct lconv *conf;
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
    conf = localeconv();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8319
    if (conf) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8320
	decimalPoint = conf->decimal_point;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8321
	thousandsSep = conf->thousands_sep;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8322
	intCurrencySymbol = conf->int_curr_symbol;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8323
	currencySymbol = conf->currency_symbol;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8324
	monDecimalPoint = conf->mon_decimal_point;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8325
	monThousandsSep = conf->mon_thousands_sep;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8326
	positiveSign = conf->positive_sign;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8327
	negativeSign = conf->negative_sign;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8328
	intFractDigits = conf->int_frac_digits;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8329
	fractDigits = conf->frac_digits;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8330
	csPosPrecedes = conf->p_cs_precedes;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8331
	csNegPrecedes = conf->n_cs_precedes;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8332
	csPosSepBySpace = conf->p_sep_by_space;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8333
	csNegSepBySpace = conf->n_sep_by_space;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8334
	csPosSignPosition = conf->p_sign_posn;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8335
	csNegSignPosition = conf->n_sign_posn;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8336
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8337
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8338
    decimalPoint = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8339
    thousandsSep = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8340
    intCurrencySymbol = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8341
    currencySymbol = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8342
    monDecimalPoint = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8343
    monThousandsSep = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8344
    positiveSign =  (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8345
    negativeSign =(char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8346
    intFractDigits = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8347
    fractDigits = -1;
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8348
    csPosPrecedes = -1;
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8349
    csNegPrecedes = -1;
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8350
    csPosSepBySpace = -1;
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8351
    csNegSepBySpace = -1;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8352
    csPosSignPosition = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8353
    csNegSignPosition = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8354
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8355
    if (decimalPoint) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8356
	val = __MKSTRING(decimalPoint);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8357
	__AT_PUT_(info, @symbol(decimalPoint), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8358
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8359
    if (thousandsSep) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8360
	val = __MKSTRING(thousandsSep);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8361
	__AT_PUT_(info, @symbol(thousandsSeparator), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8362
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8363
    if (intCurrencySymbol) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8364
	val = __MKSTRING(intCurrencySymbol);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8365
	__AT_PUT_(info, @symbol(internationCurrencySymbol), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8366
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8367
    if (currencySymbol) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8368
	val = __MKSTRING(currencySymbol);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8369
	__AT_PUT_(info, @symbol(currencySymbol), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8370
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8371
    if (monDecimalPoint) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8372
	val = __MKSTRING(monDecimalPoint);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8373
	__AT_PUT_(info, @symbol(monetaryDecimalPoint), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8374
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8375
    if (monThousandsSep) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8376
	val = __MKSTRING(monThousandsSep);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8377
	__AT_PUT_(info, @symbol(monetaryThousandsSeparator), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8378
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8379
    if (positiveSign) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8380
	val = __MKSTRING(positiveSign);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8381
	__AT_PUT_(info, @symbol(positiveSign), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8382
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8383
    if (negativeSign) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8384
	val = __MKSTRING(negativeSign);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8385
	__AT_PUT_(info, @symbol(negativeSign), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8386
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8387
    if (intFractDigits >= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8388
	__AT_PUT_(info, @symbol(internationalFractionalDigits),  __mkSmallInteger(intFractDigits));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8389
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8390
    if (fractDigits >= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8391
	__AT_PUT_(info, @symbol(fractionalDigits),  __mkSmallInteger(fractDigits));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8392
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8393
    if (csPosPrecedes >= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8394
	if (csPosPrecedes == 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8395
	    val = false;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8396
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8397
	    val = true;
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
	__AT_PUT_(info, @symbol(positiveSignPrecedesCurrencySymbol), val );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8400
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8401
    if (csNegPrecedes >= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8402
	if (csNegPrecedes == 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8403
	    val = false;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8404
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8405
	    val = true;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8406
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8407
	__AT_PUT_(info, @symbol(negativeSignPrecedesCurrencySymbol), val );
5133
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
    if (csPosSepBySpace >= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8410
	if (csPosSepBySpace == 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8411
	    val = false;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8412
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8413
	    val = true;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8414
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8415
	__AT_PUT_(info, @symbol(positiveSignSeparatedBySpaceFromCurrencySymbol), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8416
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8417
    if (csNegSepBySpace >= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8418
	if (csNegSepBySpace == 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8419
	    val = false;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8420
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8421
	    val = true;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8422
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8423
	__AT_PUT_(info, @symbol(negativeSignSeparatedBySpaceFromCurrencySymbol), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8424
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8425
    switch (csPosSignPosition) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8426
	case 0:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8427
	    val = @symbol(parenthesesAround);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8428
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8429
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8430
	case 1:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8431
	    val = @symbol(signPrecedes);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8432
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8433
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8434
	case 2:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8435
	    val = @symbol(signSuceeds);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8436
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8437
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8438
	case 3:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8439
	    val = @symbol(signPrecedesCurrencySymbol);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8440
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8441
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8442
	case 4:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8443
	    val = @symbol(signSuceedsCurrencySymbol);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8444
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8445
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8446
	default:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8447
	    val = nil;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8448
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8449
    if (val != nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8450
	__AT_PUT_(info, @symbol(positiveSignPosition), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8451
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8452
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8453
    switch (csNegSignPosition) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8454
	case 0:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8455
	    val = @symbol(parenthesesAround);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8456
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8457
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8458
	case 1:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8459
	    val = @symbol(signPrecedes);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8460
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8461
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8462
	case 2:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8463
	    val = @symbol(signSuceeds);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8464
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8465
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8466
	case 3:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8467
	    val = @symbol(signPrecedesCurrencySymbol);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8468
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8469
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8470
	case 4:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8471
	    val = @symbol(signSuceedsCurrencySymbol);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8472
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8473
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8474
	default:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8475
	    val = nil;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8476
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8477
    if (val != nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8478
	__AT_PUT_(info, @symbol(negativeSignPosition), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8479
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8480
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8481
    ^ info
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8482
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8483
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8484
     OperatingSystem getLocaleInfo
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8485
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8486
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8487
    "Created: 23.12.1995 / 14:19:20 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8488
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8489
15506
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8490
getNetworkAddresses
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8491
    "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
  8492
	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
  8493
	value -> the network adsress (as SocketAddress)
15506
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8494
     for each interface
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
    |info nAdapters rawData entry
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8498
     name description macAddress ipAddress ipAddressMask|
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
    rawData := Array new:50.
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8501
%{
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8502
/*
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8503
 * temporary undef String to avoid a #define-conflict
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8504
 * between ST/X's String and Windows String typedef
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8505
 */
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8506
# undef String
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8507
# undef Context
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8508
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8509
    IP_ADAPTER_INFO AdapterInfo[32];
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8510
    DWORD dwBufLen = sizeof(AdapterInfo);
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8511
    DWORD dwStatus;
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8512
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8513
    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
  8514
			    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
  8515
			    &dwBufLen);                  // [in] size of receive data buffer
15506
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8516
    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
  8517
	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
  8518
	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
  8519
	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
  8520
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8521
	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
  8522
	do {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8523
	    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
  8524
	    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
  8525
	    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
  8526
	    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
  8527
	    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
  8528
	    entry = __ARRAY_NEW_INT(5);
15506
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8529
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8530
/*
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8531
 * back to ST/X's String definition
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8532
 */
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8533
# ifdef __DEF_String
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8534
#  define String __DEF_String
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8535
# endif
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8536
# ifdef __DEF_String
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8537
#  define Context __DEF_Context
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8538
# endif
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8539
	    __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
  8540
	    __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
  8541
	    __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
  8542
	    __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
  8543
	    __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
  8544
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8545
	    __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
  8546
	    nA++;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8547
	    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
  8548
	} while(pAdapterInfo);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8549
	nAdapters = __mkSmallInteger(nA);
15506
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8550
    }
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8551
%}.
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8552
    "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
  8553
    info := OrderedDictionary new:nAdapters ? 0.
15506
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8554
    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
  8555
	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
  8556
	    |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
  8557
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8558
	    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
  8559
	    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
  8560
	    "/ 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
  8561
	    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
  8562
	    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
  8563
	    "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
  8564
	    (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
  8565
		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
  8566
	    ]
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8567
	].
15506
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8568
    ].
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8569
    ^ info
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8570
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8571
    "
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8572
     OperatingSystem getNetworkAddresses
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8573
    "
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8574
!
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8575
7287
b10efc6c9407 Fix spelling (getNetworkMACAddresses)
Stefan Vogel <sv@exept.de>
parents: 7199
diff changeset
  8576
getNetworkMACAddresses
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8577
    "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
  8578
	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
  8579
	value -> the MAC adress (as ByteArray)
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8580
     for each interface
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8581
    "
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8582
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8583
    |info nAdapters rawData entry
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8584
     name description macAddress ipAddress ipAddressMask|
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8585
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8586
    rawData := Array new:50.
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8587
%{
8319
2d179dc8dc3f Fix #getNetworkMACAdress for XP/2k
Claus Gittinger <cg@exept.de>
parents: 8270
diff changeset
  8588
/*
2d179dc8dc3f Fix #getNetworkMACAdress for XP/2k
Claus Gittinger <cg@exept.de>
parents: 8270
diff changeset
  8589
 * temporary undef String to avoid a #define-conflict
2d179dc8dc3f Fix #getNetworkMACAdress for XP/2k
Claus Gittinger <cg@exept.de>
parents: 8270
diff changeset
  8590
 * between ST/X's String and Windows String typedef
2d179dc8dc3f Fix #getNetworkMACAdress for XP/2k
Claus Gittinger <cg@exept.de>
parents: 8270
diff changeset
  8591
 */
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8592
# undef String
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8593
# undef Context
8319
2d179dc8dc3f Fix #getNetworkMACAdress for XP/2k
Claus Gittinger <cg@exept.de>
parents: 8270
diff changeset
  8594
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8595
    IP_ADAPTER_INFO AdapterInfo[32];
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8596
    DWORD dwBufLen = sizeof(AdapterInfo);
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8597
    DWORD dwStatus;
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  8598
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  8599
    dwStatus = GetAdaptersInfo(
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8600
			    AdapterInfo,                 // [out] buffer to receive data
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8601
			    &dwBufLen);                  // [in] size of receive data buffer
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  8602
    if (dwStatus == ERROR_SUCCESS) {
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8603
	PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8604
	unsigned char *bP;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8605
	int nA = 0;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8606
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8607
	bP = __byteArrayVal(rawData);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8608
	do {
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8609
	    name = __MKSTRING(pAdapterInfo->AdapterName);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8610
	    description = __MKSTRING(pAdapterInfo->Description);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8611
	    macAddress = __MKBYTEARRAY(pAdapterInfo->Address, 6);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8612
	    ipAddress = __MKSTRING(pAdapterInfo->IpAddressList.IpAddress.String);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8613
	    ipAddressMask = __MKSTRING(pAdapterInfo->IpAddressList.IpMask.String);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8614
	    entry = __ARRAY_NEW_INT(5);
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  8615
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8616
/*
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8617
 * back to ST/X's String definition
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8618
 */
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8619
# ifdef __DEF_String
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8620
#  define String __DEF_String
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8621
# endif
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8622
# ifdef __DEF_String
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8623
#  define Context __DEF_Context
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8624
# endif
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8625
	    __ArrayInstPtr(entry)->a_element[0] = name; __STORE(entry, name);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8626
	    __ArrayInstPtr(entry)->a_element[1] = description; __STORE(entry, description);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8627
	    __ArrayInstPtr(entry)->a_element[2] = macAddress; __STORE(entry, macAddress);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8628
	    __ArrayInstPtr(entry)->a_element[3] = ipAddress; __STORE(entry, ipAddress);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8629
	    __ArrayInstPtr(entry)->a_element[4] = ipAddressMask; __STORE(entry, ipAddressMask);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8630
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8631
	    __ArrayInstPtr(rawData)->a_element[nA] = entry; __STORE(rawData, entry);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8632
	    nA++;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8633
	    pAdapterInfo = pAdapterInfo->Next;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8634
	} while(pAdapterInfo);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8635
	nAdapters = __mkSmallInteger(nA);
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  8636
    }
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  8637
%}.
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  8638
    "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
  8639
    info := OrderedDictionary new:nAdapters ? 0.
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  8640
    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
  8641
	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
  8642
	    |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
  8643
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8644
	    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
  8645
	    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
  8646
	    "/ 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
  8647
	    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
  8648
	    "/ 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
  8649
	    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
  8650
	].
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8651
    ].
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8652
    ^ info
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8653
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8654
    "
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8655
     OperatingSystem getNetworkMACAddresses
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8656
    "
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8657
!
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8658
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8659
getNumberOfProcessors
12649
7d8aad540a9b changed comment: #getNumberOfProcessors
Stefan Vogel <sv@exept.de>
parents: 12638
diff changeset
  8660
    "answer the number of physical processors in the system"
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8661
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8662
    %{
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8663
	SYSTEM_INFO sInfo;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8664
	GetSystemInfo(&sInfo);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8665
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8666
	return __mkSmallInteger(sInfo.dwNumberOfProcessors);
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8667
    %}.
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8668
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8669
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8670
	self getNumberOfProcessors
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8671
    "
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8672
!
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8673
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8674
getProcessId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8675
    "return the (unix-)processId"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8676
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8677
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8678
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8679
    int pid = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8680
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8681
    pid = GetCurrentProcessId() & 0x3FFFFFFF;
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  8682
    RETURN ( __mkSmallInteger(pid) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8683
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8684
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8685
     OperatingSystem getProcessId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8686
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8687
!
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
getSystemID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8690
    "if supported by the OS, return the systemID;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8691
     a unique per machine identification.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8692
     WARNING:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8693
	not all systems support this; on some, 'unknown' is returned."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8694
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8695
%{  /* NO_CONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8696
#if defined(HAS_GETHOSTID)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8697
    int runningId;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8698
    OBJ arr;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8699
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8700
    runningId = gethostid();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8701
    arr = __BYTEARRAY_UNINITIALIZED_NEW_INT(4);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8702
    *(int *)(__ByteArrayInstPtr(arr)->ba_element) = runningId;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8703
    RETURN (arr);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8704
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8705
#if defined(HAS_SYSINFO) && defined(SI_HW_SERIAL)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8706
    {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8707
	char buffer[128];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8708
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8709
	buffer[0] = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8710
	if (sysinfo(SI_HW_SERIAL, buffer, sizeof(buffer))) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8711
	    buffer[127] = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8712
	    if (strlen(buffer) > 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8713
		RETURN(__MKSTRING(buffer));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8714
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8715
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8716
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8717
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8718
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8719
    ^ 'unknown'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8720
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8721
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8722
     OperatingSystem getSystemID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8723
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8724
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8725
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8726
getSystemInfo
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8727
    "return info on the system weare running on.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8728
     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
  8729
     otherwise, some simulated info is returned.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8730
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8731
     WARNING:
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8732
       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
  8733
       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
  8734
       OS, for example, linux returns 'ix86', while WIN32 returns 'x86'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8735
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8736
       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
  8737
       information.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8738
       (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
  8739
	may be based upon this info).
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8740
       Your application should NOT depend upon this in any way.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8741
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8742
     The returned info may (or may not) contain:
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8743
	#system -> some operating system identification (irix, Linux, nt, win32s ...)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8744
	#version -> OS version (some os version identification)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8745
	#release -> OS release (3.5, 1.2.1 ...)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8746
	#node   -> some host identification (hostname)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8747
	#domain  -> domain name (hosts domain)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8748
	#machine -> type of machine (i586, mips ...)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8749
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8750
     win32:
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8751
	#physicalRam -> total amount of physical memory
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8752
	#freeRam -> amount of free memory
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8753
	#swapSize -> size of swapSpace (page file)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8754
	#freeSwap -> free bytes in swapSpace
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8755
	#virtualRam -> total amount of virtual memory
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8756
	#freeVirtual -> amount of free virtual memory
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8757
	#memoryLoad -> percentage of memory usage (useless)
10746
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8758
    "
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8759
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8760
    |sys node rel ver minorVer majorVer mach dom info arch
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8761
     physicalRam freeRam swapSize freeSwap
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  8762
     virtualRam freeVirtual memoryLoad numberOfCPUs|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8763
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8764
%{  /* STACK: 4096 */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8765
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8766
    char vsnBuffer[32];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8767
    char *s;
6740
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  8768
    int winVer, verMinor, verMajor;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8769
    DWORD vsn;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8770
    SYSTEM_INFO sysInfo;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8771
    MEMORYSTATUS memStatus;
8416
77f3289fc2c7 Use snprintf for security (paranoia)
Stefan Vogel <sv@exept.de>
parents: 8412
diff changeset
  8772
    int len;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8773
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8774
    vsn = GetVersion();
6740
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  8775
    winVer = LOWORD(vsn);
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  8776
    verMinor = HIBYTE(winVer);
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  8777
    verMajor = LOBYTE(winVer);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8778
10746
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8779
    minorVer = __mkSmallInteger(verMinor);
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8780
    majorVer = __mkSmallInteger(verMajor);
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8781
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8782
    if (HIWORD(vsn) & 0x8000) {
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8783
	sys = @symbol(win95);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8784
    } else {
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8785
	if ((verMajor > 5)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8786
	 || ((verMajor == 5) && (verMinor >= 1))) {
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8787
	    sys = @symbol(xp);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8788
	    if (verMajor >= 6) {
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8789
		sys = @symbol(vista);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8790
		if (verMinor >= 1) {
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8791
		    sys = @symbol(win7);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8792
		    if (verMinor >= 2) {
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8793
			sys = @symbol(win8);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8794
		    }
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8795
		}
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8796
	    }
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8797
	} else {
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8798
	    sys = @symbol(nt);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8799
	}
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8800
    }
8416
77f3289fc2c7 Use snprintf for security (paranoia)
Stefan Vogel <sv@exept.de>
parents: 8412
diff changeset
  8801
    len = snprintf(vsnBuffer, sizeof(vsnBuffer), "%d.%d", verMajor, verMinor);
77f3289fc2c7 Use snprintf for security (paranoia)
Stefan Vogel <sv@exept.de>
parents: 8412
diff changeset
  8802
    rel = __MKSTRING_L(vsnBuffer, len);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8803
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8804
    GetSystemInfo(&sysInfo);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8805
    memStatus.dwLength = sizeof(memStatus);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8806
    GlobalMemoryStatus(&memStatus);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8807
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8808
    memoryLoad = __MKUINT(memStatus.dwMemoryLoad);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8809
    physicalRam = __MKUINT(memStatus.dwTotalPhys);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8810
    freeRam = __MKUINT(memStatus.dwAvailPhys);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8811
    swapSize = __MKUINT(memStatus.dwTotalPageFile);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8812
    freeSwap = __MKUINT(memStatus.dwAvailPageFile);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8813
    virtualRam = __MKUINT(memStatus.dwTotalVirtual);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8814
    freeVirtual = __MKUINT(memStatus.dwAvailVirtual);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8815
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8816
#if defined(__BORLANDC__) && (__BORLANDC__ <= 1339)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8817
    /* BorlandC3 ... */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8818
    switch (sysInfo.u.s.wProcessorArchitecture)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8819
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8820
    /* MSC, BorlandC4 ... */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8821
    switch (sysInfo.wProcessorArchitecture)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8822
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8823
    {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8824
#ifdef PROCESSOR_ARCHITECTURE_INTEL
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8825
	case PROCESSOR_ARCHITECTURE_INTEL:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8826
	    arch = @symbol(intel);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8827
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8828
#endif
13534
a788fd375ed1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
  8829
#ifdef PROCESSOR_ARCHITECTURE_AMD64
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8830
	case PROCESSOR_ARCHITECTURE_AMD64:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8831
	    arch = @symbol(x64);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8832
	    break;
13534
a788fd375ed1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
  8833
#endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8834
#ifdef PROCESSOR_ARCHITECTURE_MIPS
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8835
	case PROCESSOR_ARCHITECTURE_MIPS:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8836
	    arch = @symbol(mips);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8837
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8838
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8839
#ifdef PROCESSOR_ARCHITECTURE_ALPHA
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8840
	case PROCESSOR_ARCHITECTURE_ALPHA:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8841
	    arch = @symbol(alpha);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8842
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8843
#endif
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8844
#ifdef PROCESSOR_ARCHITECTURE_ALPHA64
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8845
	case PROCESSOR_ARCHITECTURE_ALPHA64:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8846
	    arch = @symbol(alpha64);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8847
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8848
#endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8849
#ifdef PROCESSOR_ARCHITECTURE_PPC
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8850
	case PROCESSOR_ARCHITECTURE_PPC:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8851
	    arch = @symbol(ppc);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8852
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8853
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8854
#ifdef PROCESSOR_ARCHITECTURE_ARM
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8855
	case PROCESSOR_ARCHITECTURE_ARM:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8856
	    arch = @symbol(arm);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8857
	    break;
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  8858
#endif
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8859
#ifdef PROCESSOR_ARCHITECTURE_SHX
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8860
	case PROCESSOR_ARCHITECTURE_SHX:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8861
	    arch = @symbol(shx);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8862
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8863
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8864
#ifdef PROCESSOR_ARCHITECTURE_IA64
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8865
	case PROCESSOR_ARCHITECTURE_IA64:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8866
	    arch = @symbol(ia64);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8867
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8868
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8869
#ifdef PROCESSOR_ARCHITECTURE_MSIL
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8870
	case PROCESSOR_ARCHITECTURE_MSIL:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8871
	    arch = @symbol(msil);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8872
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8873
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8874
#ifdef PROCESSOR_ARCHITECTURE_IA32_ON_WIN64
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8875
	case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8876
	    arch = @symbol(ia32_on_win64);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8877
	    break;
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8878
#endif
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8879
	default:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8880
	    arch = @symbol(unknown);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8881
	    break;
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8882
    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8883
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8884
    switch (sysInfo.dwProcessorType) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8885
#ifdef PROCESSOR_INTEL_386
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8886
	case PROCESSOR_INTEL_386:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8887
	    mach = @symbol(i386);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8888
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8889
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8890
#ifdef PROCESSOR_INTEL_486
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8891
	case PROCESSOR_INTEL_486:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8892
	    mach = @symbol(i486);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8893
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8894
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8895
#ifdef PROCESSOR_INTEL_PENTIUM
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8896
	case PROCESSOR_INTEL_PENTIUM:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8897
	    mach = @symbol(i586);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8898
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8899
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8900
#ifdef PROCESSOR_INTEL_860
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8901
	case PROCESSOR_INTEL_860:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8902
	    mach = @symbol(i860);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8903
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8904
#endif
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8905
#ifdef PROCESSOR_INTEL_IA64
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8906
	case PROCESSOR_INTEL_IA64:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8907
	    mach = @symbol(ia64);
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_AMD_X8664
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8911
	case PROCESSOR_AMD_X8664:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8912
	    mach = @symbol(x86_64);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8913
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8914
#endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8915
#ifdef PROCESSOR_MIPS_R2000
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8916
	case PROCESSOR_MIPS_R2000:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8917
	    mach = @symbol(r2000);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8918
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8919
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8920
#ifdef PROCESSOR_MIPS_R3000
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8921
	case PROCESSOR_MIPS_R3000:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8922
	    mach = @symbol(r3000);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8923
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8924
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8925
#ifdef PROCESSOR_MIPS_R4000
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8926
	case PROCESSOR_MIPS_R4000:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8927
	    mach = @symbol(r4000);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8928
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8929
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8930
#ifdef PROCESSOR_ALPHA_21064
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8931
	case PROCESSOR_ALPHA_21064:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8932
	    mach = @symbol(alpha21064);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8933
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8934
#endif
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8935
#ifdef PROCESSOR_ARM720
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8936
	case PROCESSOR_ARM720:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8937
	    mach = @symbol(arm720);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8938
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8939
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8940
#ifdef PROCESSOR_ARM820
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8941
	case PROCESSOR_ARM820:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8942
	    mach = @symbol(arm820);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8943
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8944
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8945
#ifdef PROCESSOR_ARM920
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8946
	case PROCESSOR_ARM920:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8947
	    mach = @symbol(arm920);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8948
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8949
#endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8950
#ifdef PROCESSOR_ARM_7TDMI
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8951
	case PROCESSOR_ARM_7TDMI:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8952
	    mach = @symbol(arm70001);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8953
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8954
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8955
#ifdef PROCESSOR_STRONGARM
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8956
	case PROCESSOR_STRONGARM:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8957
	    mach = @symbol(strongarm);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8958
	    break;
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  8959
#endif
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8960
#ifdef PROCESSOR_PPC_601
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8961
	case PROCESSOR_PPC_601:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8962
	    mach = @symbol(ppc601);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8963
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8964
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8965
#ifdef PROCESSOR_PPC_603
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8966
	case PROCESSOR_PPC_603:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8967
	    mach = @symbol(ppc603);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8968
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8969
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8970
#ifdef PROCESSOR_PPC_604
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8971
	case PROCESSOR_PPC_604:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8972
	    mach = @symbol(ppc604);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8973
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8974
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8975
#ifdef PROCESSOR_PPC_620
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8976
	case PROCESSOR_PPC_620:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8977
	    mach = @symbol(ppc620);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8978
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8979
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8980
#ifdef PROCESSOR_HITACHI_SH3
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8981
	case PROCESSOR_HITACHI_SH3:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8982
	    mach = @symbol(sh3);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8983
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8984
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8985
#ifdef PROCESSOR_HITACHI_SH3E
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8986
	case PROCESSOR_HITACHI_SH3E:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8987
	    mach = @symbol(sh3e);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8988
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8989
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8990
#ifdef PROCESSOR_HITACHI_SH4
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8991
	case PROCESSOR_HITACHI_SH4:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8992
	    mach = @symbol(sh4);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8993
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8994
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8995
#ifdef PROCESSOR_MOTOROLA_821
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8996
	case PROCESSOR_MOTOROLA_821:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8997
	    mach = @symbol(mc821);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8998
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8999
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  9000
#ifdef PROCESSOR_SHx_SH3
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  9001
	case PROCESSOR_SHx_SH3:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  9002
	    mach = @symbol(shx_sh3);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  9003
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  9004
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  9005
#ifdef PROCESSOR_SHx_SH4
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  9006
	case PROCESSOR_SHx_SH4:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  9007
	    mach = @symbol(shx_sh4);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  9008
	    break;
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  9009
#endif
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  9010
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  9011
	default:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  9012
	    sprintf(vsnBuffer, "%d", sysInfo.dwProcessorType);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  9013
	    mach =  __MKSTRING(vsnBuffer);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  9014
	    break;
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9015
    }
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  9016
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  9017
    numberOfCPUs = __MKUINT(sysInfo.dwNumberOfProcessors);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9018
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9019
    node isNil ifTrue:[
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  9020
	node := self getHostName.
5133
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
    dom isNil ifTrue:[
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  9023
	dom := self getDomainName.
5133
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9026
    info := IdentityDictionary new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9027
    info at:#system put:sys.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9028
    info at:#node put:node.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9029
    rel notNil ifTrue:[info at:#release put:rel].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9030
    ver notNil ifTrue:[info at:#version put:ver].
10746
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  9031
    majorVer notNil ifTrue:[info at:#majorVersion put:majorVer].
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  9032
    minorVer notNil ifTrue:[info at:#minorVersion put:minorVer].
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  9033
    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
  9034
    arch notNil ifTrue:[info at:#architecture put:arch].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9035
    dom notNil ifTrue:[info at:#domain put:dom].
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  9036
    numberOfCPUs notNil ifTrue:[info at:#numberOfCPUs put:numberOfCPUs].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9037
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9038
    info at:#memoryLoad put:memoryLoad.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9039
    info at:#physicalRam put:physicalRam.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9040
    info at:#freeRam put:freeRam.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9041
    info at:#swapSize put:swapSize.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9042
    info at:#freeSwap put:freeSwap.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9043
    info at:#virtualRam put:virtualRam.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9044
    info at:#freeVirtual put:freeVirtual.
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
    info at:#osType put:(self getOSType).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9047
    ^ info
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
     OperatingSystem getSystemInfo
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9051
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9052
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9053
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9054
getSystemType
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9055
    "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
  9056
     This is almost the same as getOSType, but the returned string
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9057
     is slightly different for some systems (i.e. iris vs. irix).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9058
     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
  9059
     here ...
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9060
     (except for slight differences between next/mach and other machs)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9061
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9062
    ^ #win32
5133
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
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9065
     OperatingSystem getSystemType
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9066
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9067
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9068
12837
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9069
getThreadId
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9070
    "return the (windows-) threadId"
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9071
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9072
%{  /* NOCONTEXT */
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9073
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9074
    int pid = 0;
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9075
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9076
    pid = GetCurrentThreadId() & 0x3FFFFFFF;
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9077
    RETURN ( __mkSmallInteger(pid) );
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9078
%}
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9079
    "
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9080
     OperatingSystem getThreadId
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9081
    "
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9082
!
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  9083
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9084
getWindowsDirectory
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9085
    "internal interface - only for Windows based systems.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9086
     Return the windows directory
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9087
     (which - depending on the system - may be \WINNT, \WINDOWS or whatever)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9088
     On non-windows systems, nil is returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9089
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9090
%{
13780
2f055d86569e visual c compilability
Claus Gittinger <cg@exept.de>
parents: 13778
diff changeset
  9091
    char buffer[MAXPATHLEN+1];
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9092
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9093
    if (GetWindowsDirectory(buffer, MAXPATHLEN)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9094
	RETURN (__MKSTRING(buffer));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9095
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9096
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9097
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9098
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9099
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9100
     OperatingSystem getWindowsDirectory
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9101
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9102
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9103
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9104
getWindowsSystemDirectory
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9105
    "internal interface - only for Windows based systems.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9106
     Return the windows system directory
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9107
     (which - depending on the system - may be \WINNT\SYSTEM32,
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9108
      \WINDOWS\SYSTEM or whatever)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9109
     On non-windows systems, nil is returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9110
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9111
%{
13780
2f055d86569e visual c compilability
Claus Gittinger <cg@exept.de>
parents: 13778
diff changeset
  9112
    char buffer[MAXPATHLEN+1];
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9113
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9114
    if (GetSystemDirectory(buffer, MAXPATHLEN)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9115
	RETURN (__MKSTRING(buffer));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9116
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9117
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9118
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9119
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9120
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9121
     OperatingSystem getWindowsSystemDirectory
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9122
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9123
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9124
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9125
hasConsole
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9126
    "return true, if there is some kind of console available
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9127
     (i.e. for proper stdIn, stdOut and stdErr handling).
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
  9128
     This only returns false when running únder windows, and
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9129
     the system is running as a pure windows application.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9130
     If false, the miniDebugger is useless and not used."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9131
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9132
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9133
    extern int __getNoConsoleFlag();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9134
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9135
    RETURN ( __getNoConsoleFlag() ? false : true);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9136
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9137
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9138
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9139
isMSDOSlike
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9140
    "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
  9141
     (in contrast to unix-like or vms-like).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9142
     This returns true for any of msdos, win32s, win95,
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9143
     winNT, winXP, Vista, Win7, win8 and os/2."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9144
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9145
    ^ true
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9146
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9147
    "Modified (comment): / 27-10-2012 / 14:00:52 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9148
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9149
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9150
isMSWINDOWSNTlike
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9151
    "This returns true if running in a Windows-NT system."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9152
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
  9153
     ^ true.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9154
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9155
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9156
isMSWINDOWSlike
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9157
    "return true, if running on a MS-Windows like system.
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9158
     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
  9159
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9160
    ^ true
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9161
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9162
    "Modified (comment): / 27-10-2012 / 14:01:30 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9163
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9164
13315
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  9165
isProcessIdPresent:processHandleOrPid
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  9166
    "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
  9167
     Raise an error, if an exception occures"
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9168
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9169
    |error|
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9170
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9171
%{
17117
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9172
    HANDLE processHandle, processHandleToClose = 0;
12638
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9173
    int err;
17117
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9174
    DWORD exitCode;
12638
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9175
13315
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  9176
    if (__isExternalAddressLike(processHandleOrPid) ) {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9177
	processHandle = _HANDLEVal(processHandleOrPid);
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9178
	if (processHandle == 0) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9179
	    error = @symbol(invalidParameter);
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9180
	    goto out;
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9181
	}
13315
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  9182
    } else if( __isSmallInteger(processHandleOrPid) ) {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9183
	// assume, that synchronize needs less privilege...
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9184
	processHandle = processHandleToClose = OpenProcess(SYNCHRONIZE, FALSE, __smallIntegerVal(processHandleOrPid));
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9185
	if (!processHandle) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9186
	    goto checkError;
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9187
	}
17117
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9188
    } else {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9189
	error = @symbol(invalidParameter);
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9190
	goto out;
17117
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9191
    }
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9192
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9193
    /* check if the handle still refers to a running process */
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9194
    if (GetExitCodeProcess(processHandle, &exitCode) != 0) {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9195
	if (processHandleToClose)
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9196
	    CloseHandle(processHandleToClose);
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9197
	if (exitCode == STILL_ACTIVE) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9198
	    RETURN(true);
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9199
	} else {
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9200
	    RETURN(false);
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9201
	}
17117
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9202
    } else if (processHandleToClose) {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9203
	CloseHandle(processHandleToClose);
17117
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9204
    }
13315
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  9205
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  9206
checkError:
17117
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9207
    err = GetLastError();
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9208
    // we do not have access to the process (so pid does exist ;-))
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9209
    if (err == ERROR_ACCESS_DENIED) {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9210
	RETURN(true);
17117
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9211
    }
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9212
    // pid does not exist
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9213
    if (err == ERROR_INVALID_PARAMETER) {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
  9214
	RETURN(false);
17117
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9215
    }
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9216
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9217
    // any other error - raise signal
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9218
    __threadErrno = __WIN32_ERR(err);
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9219
    error = __mkSmallInteger(__threadErrno);
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9220
out:;
12638
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9221
%}.
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9222
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9223
    self primitiveFailed:error.
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9224
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9225
    "
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9226
      self isProcessIdPresent:(self getProcessId)
17117
4a6ee105223e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17042
diff changeset
  9227
      self isProcessIdPresent:10196
12638
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9228
      self isProcessIdPresent:512
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9229
      self isProcessIdPresent:'abc'
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9230
    "
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9231
!
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  9232
10746
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  9233
isVistaLike
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9234
    "return true, if running on a Vista (or newer) like system.
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9235
     (also true for server 2008)"
10746
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  9236
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  9237
    ^ (self getSystemInfo at:#majorVersion) >= 6
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  9238
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  9239
    "
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  9240
     self isVistaLike
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  9241
    "
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9242
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9243
    "Modified (comment): / 27-10-2012 / 13:59:53 / cg"
10746
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  9244
!
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  9245
19335
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9246
isWin10Like
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9247
    "return true, if running on a Windows10 (or newer) like system.
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9248
     (also true for server 2016)"
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9249
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9250
    |sysInfo major|
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9251
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9252
    sysInfo := self getSystemInfo.
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9253
    major := sysInfo at:#majorVersion.
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9254
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9255
    ^ (major >= 10)
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9256
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9257
    "
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9258
     self isWin10Like
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9259
    "
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9260
!
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
  9261
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9262
isWin7Like
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9263
    "return true, if running on a Windows7 (or newer) like system."
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9264
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9265
    |sysInfo major|
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9266
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9267
    sysInfo := self getSystemInfo.
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9268
    major := sysInfo at:#majorVersion.
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9269
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9270
    ^ (major == 6 and:[(sysInfo at:#minorVersion) >= 1])
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9271
      or:[major > 6]
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9272
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9273
    "
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9274
     self isWin7Like
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9275
    "
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9276
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9277
    "Modified (comment): / 27-10-2012 / 13:59:14 / cg"
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9278
!
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9279
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9280
isWin8Like
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9281
    "return true, if running on a Windows8 (or newer) like system.
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9282
     (also true for server 2012)"
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9283
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9284
    |sysInfo major|
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9285
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9286
    sysInfo := self getSystemInfo.
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9287
    major := sysInfo at:#majorVersion.
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9288
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9289
    ^ (major == 6 and:[(sysInfo at:#minorVersion) >= 2])
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9290
      or:[major > 6]
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9291
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9292
    "
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9293
     self isWin8Like
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9294
    "
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9295
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  9296
    "Created: / 27-10-2012 / 13:59:03 / cg"
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9297
!
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  9298
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9299
maxFileNameLength
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9300
    "return the max number of characters in a filename.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9301
     CAVEAT:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9302
	 Actually, the following is somewhat wrong - some systems
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9303
	 support different sizes, depending on the volume.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9304
	 We return a somewhat conservative number here.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9305
	 Another entry, to query for volume specific max
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9306
	 will be added in the future."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9307
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9308
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9309
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9310
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9311
     * TODO: newer systems provide a query function for this ... use it
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9312
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9313
     /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9314
      * mhmh - depends on the filesystem type
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9315
      */
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  9316
     RETURN ( __mkSmallInteger(MAXFILELEN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9317
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9318
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9319
     OperatingSystem maxFileNameLength
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9320
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9321
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9322
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9323
maxPathLength
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9324
    "return the max number of characters in a pathName."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9325
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9326
%{  /* NOCONTEXT */
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  9327
    RETURN ( __mkSmallInteger(MAXPATHLEN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9328
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9329
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9330
     OperatingSystem maxPathLength
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9331
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9332
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9333
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9334
osName
13533
82dc48a9a6ae changed: #osName
Claus Gittinger <cg@exept.de>
parents: 13341
diff changeset
  9335
    |osVersion|
82dc48a9a6ae changed: #osName
Claus Gittinger <cg@exept.de>
parents: 13341
diff changeset
  9336
82dc48a9a6ae changed: #osName
Claus Gittinger <cg@exept.de>
parents: 13341
diff changeset
  9337
    osVersion := OperatingSystem osVersion.
13128
35def02e40f4 CloseHandle added in: getAllProcesses
Michael Beyl <mb@exept.de>
parents: 13114
diff changeset
  9338
    ^ 'Windows ',
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  9339
	(#('2000' 'XP' 'Server2003' 'VISTA' '7' '8')
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  9340
	    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
  9341
	    ifAbsent:osVersion).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9342
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9343
    "
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9344
     self osName
13533
82dc48a9a6ae changed: #osName
Claus Gittinger <cg@exept.de>
parents: 13341
diff changeset
  9345
    "
82dc48a9a6ae changed: #osName
Claus Gittinger <cg@exept.de>
parents: 13341
diff changeset
  9346
82dc48a9a6ae changed: #osName
Claus Gittinger <cg@exept.de>
parents: 13341
diff changeset
  9347
    "Modified (comment): / 30-07-2011 / 17:00:50 / cg"
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9348
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9349
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9350
osVersion
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9351
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9352
    ^OperatingSystem getSystemInfo at:#release
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9353
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9354
    "Created: / 19-01-2007 / 13:15:47 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9355
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9356
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9357
pathSeparator
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9358
    "return the character which separates items in the PATH variable"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9359
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9360
    ^ $;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9361
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9362
    "Created: 2.5.1997 / 11:36:47 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9363
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9364
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9365
platformName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9366
    "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
  9367
     This returns #unix for all unix derivatives,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9368
     #os2, #win32, #vms or #mac for the others.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9369
     I.e. it is much less specific than getOSType or getSystemType."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9370
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9371
    ^ #win32
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9372
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9373
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9374
     OperatingSystem platformName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9375
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9376
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9377
    "Modified: 20.6.1997 / 17:37:26 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9378
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9379
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  9380
randomBytesInto:bufferOrInteger
12827
c50946e5abe3 comment/format in: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12825
diff changeset
  9381
    "If bufferOrInteger is a String or a ByteArray,
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9382
	fill a given buffer with random bytes from the RtlGenRandom function
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9383
	and nswer the buffer.
12827
c50946e5abe3 comment/format in: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12825
diff changeset
  9384
c50946e5abe3 comment/format in: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12825
diff changeset
  9385
     If bufferOrInteger is a SmallInteger,
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9386
	return this many bytes (max 4) as a SmallInteger.
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  9387
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  9388
     Return nil on error (and raise PrimitiveFailure).
12827
c50946e5abe3 comment/format in: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12825
diff changeset
  9389
c50946e5abe3 comment/format in: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12825
diff changeset
  9390
     NOTE: This is a private interface, please use RandomGenerator!!"
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  9391
12773
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9392
%{
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9393
//    BOOLEAN RtlGenRandom(
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9394
//      __out  PVOID RandomBuffer,
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9395
//      __in   ULONG RandomBufferLength
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9396
//    );
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9397
    static BOOL (__stdcall *P_RtlGenRandom)(PVOID , ULONG) = 0;
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9398
    unsigned char *__buffer;
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9399
    int __bufferSize;
12825
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  9400
    int __useLocalBuffer = 0;
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  9401
    unsigned int __localBuffer = 0;
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  9402
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  9403
    if (__isSmallInteger(bufferOrInteger)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9404
	__useLocalBuffer = 1;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9405
	__buffer = (unsigned char *)&__localBuffer;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9406
	__bufferSize = __smallIntegerVal(bufferOrInteger);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9407
	if (__bufferSize > sizeof(INT))
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9408
	    __bufferSize = sizeof(INT);
12825
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  9409
    } else if (__isString(bufferOrInteger)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9410
	__buffer = __stringVal(bufferOrInteger);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9411
	__bufferSize = __stringSize(bufferOrInteger);
12825
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  9412
    } else if (__isByteArray(bufferOrInteger)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9413
	__buffer = __byteArrayVal(bufferOrInteger);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9414
	__bufferSize = __byteArraySize(bufferOrInteger);
12773
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9415
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9416
	goto error;
12773
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9417
    }
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9418
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9419
    if (P_RtlGenRandom == 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9420
	HINSTANCE hAdvapi32 = LoadLibrary("advapi32.dll");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9421
	// console_printf("hAdvapi32: %x\n", hAdvapi32);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9422
	if (hAdvapi32) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9423
	    P_RtlGenRandom = (BOOL (__stdcall *)(PVOID , ULONG))
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9424
				GetProcAddress(hAdvapi32, "SystemFunction036");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9425
	    // console_printf("P_RtlGenRandom: %x\n", P_RtlGenRandom);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9426
	    if (P_RtlGenRandom == 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9427
		goto error;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9428
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9429
	}
12773
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9430
    }
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9431
    if ((*P_RtlGenRandom)(__buffer, __bufferSize)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9432
	if (__useLocalBuffer) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9433
	    RETURN(__mkSmallInteger(__localBuffer & _MAX_INT));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9434
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9435
	RETURN (bufferOrInteger);
12773
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9436
    }
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9437
error: ;
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9438
%}.
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9439
    self primitiveFailed.
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9440
    ^ nil
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9441
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9442
    "
12825
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  9443
     self randomBytesInto:(ByteArray new:4)
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  9444
     self randomBytesInto:4
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  9445
     self randomBytesInto:1
12773
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9446
    "
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9447
!
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  9448
12603
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9449
setEnvironment:aStringOrSymbol to:newValueString
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9450
    "set an environment variable"
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9451
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9452
%{  /* NOCONTEXT */
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9453
    char *env;
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9454
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9455
    if (__isStringLike(aStringOrSymbol)
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9456
     && __isStringLike(newValueString) ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9457
	if (SetEnvironmentVariable(__stringVal(aStringOrSymbol), __stringVal(newValueString)) != 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9458
	    RETURN(self);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9459
	}
12603
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9460
    }
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9461
%}.
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9462
    self primitiveFailed
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9463
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9464
    "
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  9465
     OperatingSystem getEnvironment:'PATH'
12603
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9466
     OperatingSystem setEnvironment:'PATH' to:('c:\cygwin\bin;' , (OperatingSystem getEnvironment:'PATH'))
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9467
    "
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9468
!
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  9469
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9470
setLocaleInfo:anInfoDictionary
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9471
    "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
  9472
     (internal in ST/X only - the OS's settings remain unaffected)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9473
     See description of fields in #getLocaleInfo.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9474
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9475
     Notice, that (for now), the system does not use this information;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9476
     it should be used by applications as required."
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
    LocaleInfo := anInfoDictionary
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9479
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
     |d|
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
     d := IdentityDictionary new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9484
     d at:#decimalPoint                 put:'.'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9485
     d at:#thousandsSeparator           put:','         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9486
     d at:#currencySymbol               put:'USD'       .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9487
     d at:#monetaryDecimalPoint         put:'.'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9488
     d at:#monetaryThousandsSeparator   put:'.'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9489
     d at:#fractionalDigits             put:2           .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9490
     d at:#positiveSign                 put:'+'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9491
     d at:#negativeSign                 put:'-'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9492
     d at:#positiveSignPrecedesCurrencySymbol put:true          .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9493
     d at:#negativeSignPrecedesCurrencySymbol put:false         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9494
     OperatingSystem setLocaleInfo:d
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9495
    "
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
supportsChildInterrupts
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9499
    "return true, if the OS supports childProcess termination signalling
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9500
     through interrupts (i.e. SIGCHILD)"
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
%{  /* NOCONTEXT */
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9503
#if defined(SIGCHLD) || defined(SIGCLD)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9504
    RETURN (true);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9505
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9506
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9507
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9508
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9509
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9510
     OperatingSystem supportsChildInterrupts
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9511
    "
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
supportsFileOwnerGroups
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9515
    "return true, if the OS's file system supports file
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9516
     group ownership - all OS's except windows do"
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
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9519
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9520
    "Created: / 10.9.1998 / 17:57:03 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9521
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9522
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9523
supportsFileOwners
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9524
    "return true, if the OS's file system supports file
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9525
     ownership - all OS's except windows do"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9526
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9527
    ^ false
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
    "Created: / 10.9.1998 / 17:55:16 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9530
    "Modified: / 10.9.1998 / 17:57:11 / 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
supportsIOInterrupts
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9534
    "return true, if the OS supports IO availability interrupts
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9535
     (i.e. SIGPOLL/SIGIO).
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
     Currently, this mechanism does not work on all
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9538
     systems ...
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9541
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9542
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9543
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9544
     OperatingSystem supportsIOInterrupts
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9545
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9546
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9547
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9548
supportsNonBlockingIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9549
    "return true, if the OS supports nonblocking IO."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9550
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9551
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9552
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9553
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9554
     OperatingSystem supportsNonBlockingIO
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9555
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9556
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9557
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9558
supportsSelect
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9559
    "return true, if the OS supports selecting on multiple
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9560
     filedescriptors via select.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9561
     If false is returned, ProcessorScheduler will poll in 50ms
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9562
     intervals for I/O becoming ready."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9563
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9564
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9565
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9566
# if defined(WIN32S)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9567
    RETURN (false);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9568
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9569
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9570
    ^ true
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9571
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9572
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9573
     OperatingSystem supportsSelect
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9574
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9575
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9576
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9577
supportsSelectOnPipes
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9578
    "return true, if the OS supports selecting on pipe
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9579
     filedescriptors via select.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9580
     If false is returned, ProcessorScheduler will poll in 50ms
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9581
     intervals for I/O becoming ready."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9582
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9583
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9584
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9585
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9586
     OperatingSystem supportsSelectOnPipes
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9587
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9588
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9589
    "Modified: / 14.12.1999 / 19:41:03 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9590
    "Created: / 14.12.1999 / 19:43:13 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9591
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9592
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9593
supportsSelectOnSockets
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9594
    "return true, if the OS supports selecting on socket
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9595
     filedescriptors via select.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9596
     If false is returned, ProcessorScheduler will poll in 50ms
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9597
     intervals for I/O becoming ready."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9598
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9599
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9600
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9601
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9602
     OperatingSystem supportsSelectOnSockets
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9603
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9604
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9605
    "Modified: / 14.12.1999 / 19:41:03 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9606
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9607
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9608
supportsVolumes
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9609
    "return true, if the OS supports disk volumes.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9610
     False is returned for UNIX, true for MSDOS and VMS"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9611
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9612
    ^ true
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9613
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9614
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9615
!Win32OperatingSystem class methodsFor:'path queries'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9616
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9617
defaultPackagePath
5147
305aa6d3926a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  9618
    |pPath pkgDirPath dirs p|
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9619
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9620
    pPath := super defaultPackagePath.
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9621
    pkgDirPath := self stxPackageDirPath.
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9622
    pkgDirPath notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9623
	"/ and also add the packageDirPath from the registry ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9624
	dirs := pkgDirPath asCollectionOfSubstringsSeparatedBy:$;.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9625
	dirs do:[:aDir |
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9626
	    (pPath includes:aDir) ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9627
		pPath add:aDir.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9628
	    ]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9629
	]
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9630
    ] ifFalse:[
13341
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9631
"/        #(
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9632
"/            '\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9633
"/            '\programme\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9634
"/            '\programme\eXept\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9635
"/            '\programs\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9636
"/            '\programs\eXept\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9637
"/        ) do:[:d | |dd|
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9638
"/            dd := d asFilename constructString:'packages'.
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9639
"/            (pPath includes:dd) ifFalse:[
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9640
"/                pPath add:dd.
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9641
"/            ].
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9642
"/            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
  9643
"/            (pPath includes:dd) ifFalse:[
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9644
"/                pPath add:dd.
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9645
"/            ].
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9646
"/        ].
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9647
    ].
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9648
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9649
    "/ under windows, the commandName includes the path - good.
5922
c36b3ecb61f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5918
diff changeset
  9650
    p := Smalltalk commandName.
c36b3ecb61f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5918
diff changeset
  9651
    p notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9652
	p := p asFilename directory constructString:'packages'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9653
	(pPath includes:p) ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9654
	    pPath add:p.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9655
	]
5147
305aa6d3926a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  9656
    ].
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9657
    pPath := pPath select:[:p | p asFilename exists].
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9658
    ^ pPath
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9659
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9660
    "
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9661
     self defaultPackagePath
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9662
    "
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9663
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9664
    "Created: / 24.12.1999 / 00:10:41 / cg"
5147
305aa6d3926a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  9665
    "Modified: / 24.12.1999 / 00:33:26 / cg"
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9666
!
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9667
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9668
defaultSystemPath
9021
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9014
diff changeset
  9669
    |sysPath libDirPath|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9670
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9671
    sysPath := super defaultSystemPath.
9014
f4df89a42724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9013
diff changeset
  9672
5136
faa3c9f42b8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  9673
    libDirPath := self stxLibDirPath.
faa3c9f42b8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  9674
    libDirPath notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9675
	"/ and also add the libDirPath from the registry ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9676
	(sysPath includes:libDirPath) ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9677
	    sysPath add:libDirPath
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9678
	].
9021
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9014
diff changeset
  9679
    ].
13341
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9680
"/    #(
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9681
"/        '\programs\eXept\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9682
"/        '\programme\eXept\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9683
"/        '\programs\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9684
"/        '\programme\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9685
"/        '\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9686
"/    ) do:[:dir |
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9687
"/        |vsnDir|
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9688
"/
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9689
"/        (dir asFilename isDirectory) ifTrue:[
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9690
"/            vsnDir := dir , '\' , Smalltalk versionString.
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9691
"/            (vsnDir asFilename isDirectory) ifTrue:[
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9692
"/                (sysPath includes:vsnDir) ifFalse:[
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9693
"/                    sysPath add:vsnDir.
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9694
"/                ]
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9695
"/            ].
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9696
"/            (sysPath includes:dir) ifFalse:[
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9697
"/                sysPath add:dir.
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9698
"/            ].
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9699
"/        ]
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9700
"/    ].
9021
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9014
diff changeset
  9701
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9702
    ^ sysPath
5136
faa3c9f42b8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  9703
5147
305aa6d3926a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  9704
    "Modified: / 24.12.1999 / 00:29:18 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9705
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9706
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9707
stxBinDirPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9708
    "ask the registry for the binary directory"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9709
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9710
    |k p|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9711
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9712
    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
  9713
    k notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9714
	p := k valueNamed:'BinDir'.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9715
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9716
    ^ p
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9717
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9718
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9719
     OperatingSystem stxBinDirPath
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9720
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9721
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9722
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9723
stxLibDirPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9724
    "ask the registry for the lib directory"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9725
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  9726
    (Array
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9727
	with:('HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X\' , Smalltalk versionString)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9728
	with:('HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'))
9021
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9014
diff changeset
  9729
    do:[:eachKeyToTry |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9730
	|k p|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9731
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9732
	k := RegistryEntry key:eachKeyToTry.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9733
	k notNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9734
	    p := k valueNamed:'LibDir'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9735
	    k closeKey.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9736
	    ^ p
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9737
	].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9738
    ].
9021
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9014
diff changeset
  9739
    ^ nil
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9740
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9741
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9742
     OperatingSystem stxLibDirPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9743
    "
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9744
!
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9745
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9746
stxPackageDirPath
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9747
    "ask the registry for the package directory"
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9748
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9749
    |k p|
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9750
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9751
    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
  9752
    k notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9753
	p := k valueNamed:'PackageDirPath'.
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9754
    ].
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9755
    ^ p
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9756
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9757
    "
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9758
     OperatingSystem stxPackageDirPath
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9759
    "
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9760
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9761
    "Created: / 24.12.1999 / 00:11:12 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9762
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9763
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9764
!Win32OperatingSystem class methodsFor:'printing support'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9765
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9766
abortDoc: deviceContext
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9767
    ^ self primAbortDoc:deviceContext
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9768
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9769
    "Created: / 02-08-2006 / 12:52:12 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9770
    "Modified: / 04-10-2006 / 11:34:37 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9771
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9772
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9773
closePrinter:handle
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9774
    self primClosePrinter:handle
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9775
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9776
    "Created: / 28-07-2006 / 17:55:59 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9777
    "Modified: / 04-10-2006 / 11:34:34 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9778
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9779
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9780
createPrinterDC:driverName device:deviceName output:outputMedium initData:driverData
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9781
    |h|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9782
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9783
    h := self primCreatePrinterDC:driverName device:deviceName output:outputMedium initData:driverData.
10529
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9784
"/    h notNil ifTrue:[
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9785
"/        ^ (Win32Handle newAddress:h address) registerForFinalization
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9786
"/    ].
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9787
    ^ h
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9788
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9789
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9790
     |p hPrinter driverNm mediumNm deviceNm driverData hDC|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9791
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9792
     p := self getPrinters first.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9793
     driverNm := p attributes at:#driverName.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9794
     mediumNm := p attributes at:#medium.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9795
     deviceNm := p printerName.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9796
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9797
     hPrinter := self openPrinter:deviceNm.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9798
     driverData := self getDocumentProperties:nil hPrinter:hPrinter pDeviceName:deviceNm.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9799
     self primClosePrinter:hPrinter.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9800
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9801
     hDC := self createPrinterDC:driverNm device:deviceNm output:mediumNm initData:driverData.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9802
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9803
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9804
    "Created: / 27-07-2006 / 16:22:34 / fm"
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
  9805
    "Modified: / 16-04-2007 / 13:09:16 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9806
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9807
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  9808
deletePrinterDC: hwndArg
10529
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9809
    |return|
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  9810
    return := self primDeletePrinterDC:hwndArg .
10529
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9811
    ^return
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9812
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9813
    "Created: / 27-07-2006 / 16:22:34 / fm"
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9814
!
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9815
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9816
documentPropertiesDialogFor:hwndOrNil hPrinter:hPrinter pDeviceName:deviceName devModeInput:pDevModeInputOrNil
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9817
    |nBytesNeeded hPrinter rslt devModeOutput|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9818
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9819
"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9820
#define DM_UPDATE           1
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9821
#define DM_COPY             2
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9822
#define DM_PROMPT           4
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9823
#define DM_MODIFY           8
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9824
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9825
#define DM_IN_BUFFER        DM_MODIFY
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9826
#define DM_IN_PROMPT        DM_PROMPT
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9827
#define DM_OUT_BUFFER       DM_COPY
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9828
#define DM_OUT_DEFAULT      DM_UPDATE
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9829
"
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9830
    nBytesNeeded := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9831
	   primDocumentProperties:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9832
	   hPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9833
	   pDeviceName: deviceName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9834
	   pDevModeOutput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9835
	   pDevModeInput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9836
	   fMode:0.
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9837
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9838
    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
  9839
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9840
    rslt := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9841
	   primDocumentProperties:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9842
	   hPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9843
	   pDeviceName: deviceName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9844
	   pDevModeOutput:devModeOutput
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9845
	   pDevModeInput:pDevModeInputOrNil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9846
	   fMode:4+2.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9847
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9848
    ^ devModeOutput
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9849
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9850
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9851
     |h|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9852
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9853
     h := self openPrinter:'\\http://exept.exept.de:631\lj4'.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9854
     self documentPropertiesDialogFor:nil hPrinter:h pDeviceName:'\\http://exept.exept.de:631\lj4' devModeInput:nil
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
    "Created: / 27-07-2006 / 15:39:21 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9858
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9859
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9860
endDoc: deviceContext
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9861
    ^ self primEndDoc:deviceContext
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9862
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9863
    "Created: / 27-07-2006 / 19:46:19 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9864
    "Modified: / 28-07-2006 / 19:23:03 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9865
    "Modified: / 04-10-2006 / 11:35:01 / 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
endPage: deviceContext
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9869
    ^ self primEndPage:deviceContext
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9870
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9871
    "Created: / 27-07-2006 / 19:45:28 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9872
    "Modified: / 28-07-2006 / 18:49:40 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9873
    "Modified: / 04-10-2006 / 11:35:06 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9874
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9875
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9876
getDefaultPrinterName
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9877
    "returns the default printer name"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9878
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9879
    ^ (self getProfileString:'windows' key:'device' default:'')
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9880
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9881
    "
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9882
     OperatingSystem getDefaultPrinterName
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9883
    "
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9884
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9885
    "Created: / 02-08-2006 / 17:25:34 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9886
    "Modified: / 04-10-2006 / 11:35:18 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9887
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9888
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  9889
getDeviceCaps:hwndArg index: index
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  9890
    ^ self primGetDeviceCaps:hwndArg index: index
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9891
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9892
    "Created: / 28-07-2006 / 17:45:27 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9893
    "Modified: / 04-10-2006 / 11:35:29 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9894
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9895
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9896
getDocumentProperties:hwndOrNil hPrinter:hPrinter pDeviceName:deviceName
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9897
    |nBytesNeeded rslt devModeOutput|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9898
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9899
"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9900
#define DM_UPDATE           1
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9901
#define DM_COPY             2
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9902
#define DM_PROMPT           4
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9903
#define DM_MODIFY           8
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9904
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9905
#define DM_IN_BUFFER        DM_MODIFY
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9906
#define DM_IN_PROMPT        DM_PROMPT
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9907
#define DM_OUT_BUFFER       DM_COPY
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9908
#define DM_OUT_DEFAULT      DM_UPDATE
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9909
"
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9910
    nBytesNeeded := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9911
	   primDocumentProperties:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9912
	   hPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9913
	   pDeviceName: deviceName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9914
	   pDevModeOutput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9915
	   pDevModeInput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9916
	   fMode:0.
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9917
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9918
    nBytesNeeded < 0 ifTrue:[^nil].
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9919
    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
  9920
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9921
    rslt := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9922
	   primDocumentProperties:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9923
	   hPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9924
	   pDeviceName: deviceName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9925
	   pDevModeOutput:devModeOutput
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9926
	   pDevModeInput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9927
	   fMode:2.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9928
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9929
     ^ devModeOutput
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9930
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9931
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9932
     |h|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9933
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9934
     h := self openPrinter:'\\http://exept.exept.de:631\lj4'.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9935
     self getDocumentProperties:nil hPrinter:h pDeviceName:'\\http://exept.exept.de:631\lj4'
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9936
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9937
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9938
    "Created: / 27-07-2006 / 15:38:03 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9939
    "Modified: / 31-07-2006 / 13:02:02 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9940
    "Modified: / 04-10-2006 / 11:35:39 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9941
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9942
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9943
getPrinterInfo2: printerName
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9944
    |hPrinter rslt informationBuffer bytesNeeded sizeBytesArray|
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9945
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9946
     hPrinter := self openPrinter: printerName .
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9947
     sizeBytesArray := ByteArray new:4.
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
  9948
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9949
     bytesNeeded := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9950
		primGetPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9951
		level:2
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9952
		informationBuffer: nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9953
		bufferSize: 0
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9954
		bufferNeededSize:sizeBytesArray.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9955
     bytesNeeded := sizeBytesArray longAt:1.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9956
     informationBuffer := PrinterInfo2Structure new: bytesNeeded.
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9957
     rslt := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9958
		primGetPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9959
		level:2
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9960
		informationBuffer:informationBuffer
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9961
		bufferSize: bytesNeeded
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9962
		bufferNeededSize:sizeBytesArray.
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9963
     self closePrinter: printerName.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9964
     ^informationBuffer
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9965
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9966
    "
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9967
     OperatingSystem getPrinterInfo2:(OperatingSystem getDefaultPrinterName)
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9968
    "
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9969
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9970
    "Created: / 01-08-2006 / 13:47:19 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9971
    "Modified: / 04-10-2006 / 11:36:41 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9972
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9973
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9974
getPrinters
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9975
    "return a collection of PrinterInfos"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9976
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9977
    |printerNames collectedInfo|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9978
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9979
    printerNames := self getPrintersNames.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9980
    collectedInfo := OrderedCollection new.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9981
    printerNames do:[:eachName |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9982
	|fn vol attributes nm deviceInfo infoFields driverName|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9983
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9984
	attributes := Dictionary new.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9985
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9986
	fn := eachName asFilename.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9987
	vol := fn volume.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9988
	vol notEmptyOrNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9989
	    (vol startsWith:'\\') ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9990
		"/ a remote printer
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9991
		attributes at:#isRemotePrinter put:true.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9992
		attributes at:#remotePrinterName put:(fn baseName).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9993
		attributes at:#remotePrinterHost put:(fn directoryName copyFrom:3).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9994
	    ] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9995
		"/ some other printer
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9996
	    ].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9997
	] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9998
	    "/ some other printer
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9999
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10000
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10001
	deviceInfo := self getProfileString:'PrinterPorts' key:eachName default:''.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10002
	"gives us smething like 'winspool,Ne00:,15,45',
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10003
	 which is: driverName, deviceName, ? , ?"
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10004
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10005
	infoFields := deviceInfo asCollectionOfSubstringsSeparatedBy:$,.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10006
	driverName := infoFields at:1.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10007
	2 to: infoFields size by:3 do:[:i |
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10008
	    |medium longName|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10009
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10010
	    medium := infoFields at:i.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10011
	    longName := eachName ,',' , driverName , ',' , medium.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10012
	    attributes at:#driverName put:driverName.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10013
	    attributes at:#longName put:longName.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10014
	    attributes at:#medium put:medium.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10015
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10016
	    collectedInfo add:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10017
		(AbstractOperatingSystem::PrinterInfo new
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10018
		    printerName:eachName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10019
		    attributes:attributes;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10020
		    setDocumentProperties;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10021
		    yourself)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10022
	].
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10023
    ].
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10024
    ^ collectedInfo
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10025
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10026
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10027
     OperatingSystem getPrinters
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 / 12:18:11 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10031
    "Modified: / 31-07-2006 / 13:06:04 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10032
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10033
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10034
getPrintersNames
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10035
    "return a collection of Printer names"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10036
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10037
    |printerNames|
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10038
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10039
    printerNames := (self getProfileString:'PrinterPorts' key:nil default:'')
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10040
		       asCollectionOfSubstringsSeparatedBy:(Character value:0).
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10041
    printerNames := printerNames reject:[:nm | nm isEmpty].
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10042
    ^printerNames
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10043
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10044
    "
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10045
     OperatingSystem getPrintersNames
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10046
    "
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10047
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10048
    "Created: / 27-07-2006 / 17:55:46 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10049
    "Modified: / 04-10-2006 / 11:37:41 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10050
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10051
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10052
getTextExtentPoint: handle string: lpString size: pSize
11085
ff0e28fd7027 changed #primReleaseMutex:
fm
parents: 11084
diff changeset
 10053
ff0e28fd7027 changed #primReleaseMutex:
fm
parents: 11084
diff changeset
 10054
   ^self primGetTextExtentPoint: handle string: lpString count: lpString size size: pSize
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10055
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10056
    "Created: / 03-08-2006 / 11:17:17 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10057
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10058
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10059
getTextMetrics: deviceContext lpMetrics: textMetrics
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10060
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10061
    ^self primGetTextMetrics: deviceContext lpMetrics: textMetrics
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10062
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10063
    "Created: / 02-08-2006 / 16:07:07 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10064
    "Modified: / 04-10-2006 / 11:37:49 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10065
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10066
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10067
openPrinter:name
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10068
    |h hh rslt|
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10069
19346
Claus Gittinger <cg@exept.de>
parents: 19339
diff changeset
 10070
    hh := ByteArray new:(ExternalAddress pointerSize).
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10071
    rslt := self primOpenPrinter:name handleHolder:hh ignored:nil.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10072
    rslt ifFalse:[^ nil].
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10073
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10074
    h := Win32PrinterHandle new setAddressFromBytes:hh.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10075
    h registerForFinalization.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10076
    ^ h
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10077
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10078
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10079
     self openPrinter:'\\http://exept.exept.de:631\lj4'
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10080
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10081
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10082
    "Created: / 27-07-2006 / 14:40:41 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10083
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10084
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 10085
primAbortDoc:hwndArg
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10086
    <apicall: int32 "AbortDoc" (handle) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10087
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10088
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10089
    "Created: / 02-08-2006 / 12:52:32 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10090
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10091
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10092
primClosePrinter:handle
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10093
    <apicall: bool "ClosePrinter" ( handle ) module: "winspool.drv" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10094
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10095
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10096
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10097
     |h hh rslt|
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10098
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10099
     hh := ByteArray new:4.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10100
     rslt := self primOpenPrinter:'\\http://exept.exept.de:631\lj4' handleHolder:hh ignored: nil.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10101
     h := Win32PrinterHandle new setAddressFromBytes:hh.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10102
     self primClosePrinter: h.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10103
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10104
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10105
    "Created: / 27-07-2006 / 14:47:12 / fm"
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
primCreatePrinterDC:driverName device:deviceName output:outputMedium initData:driverData
10529
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
 10109
    <apicall: handle "CreateDCA" ( pointer pointer pointer pointer ) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10110
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10111
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10112
    "Modified: / 27-07-2006 / 16:26:25 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10113
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10114
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 10115
primDeletePrinterDC: hwndArg
10529
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
 10116
    <apicall: bool "DeleteDC" ( handle ) module: "gdi32.dll" >
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
 10117
    self primitiveFailed.
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
 10118
!
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
 10119
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10120
primDocumentProperties:hwndOrNil hPrinter:hPrinter pDeviceName:deviceName pDevModeOutput:pDevModeOutput pDevModeInput:pDevModeInput fMode:fMode
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10121
    <apicall: int32 "DocumentPropertiesA" ( handle handle lpstr pointer pointer uint32) module: "winspool.drv" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10122
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10123
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10124
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10125
     |hPrinter rslt|
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10126
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10127
     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
 10128
     rslt := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10129
	    primDocumentProperties:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10130
	    hPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10131
	    pDeviceName: '\\http://exept.exept.de:631\lj4'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10132
	    pDevModeOutput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10133
	    pDevModeInput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10134
	    fMode:0.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10135
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10136
     self halt.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10137
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10138
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10139
    "Created: / 27-07-2006 / 15:02:14 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10140
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10141
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 10142
primEndDoc:hwndArg
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10143
    <apicall: int32 "EndDoc" (handle) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10144
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10145
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10146
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10147
     |hPrinter rslt|
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10148
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10149
     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
 10150
     rslt := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10151
	    primDocumentProperties:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10152
	    hPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10153
	    pDeviceName: '\\http://exept.exept.de:631\lj4'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10154
	    pDevModeOutput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10155
	    pDevModeInput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10156
	    fMode:0.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10157
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10158
     self halt.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10159
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10160
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10161
    "Created: / 27-07-2006 / 19:31:31 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10162
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10163
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 10164
primEndPage:hwndArg
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10165
    <apicall: int32 "EndPage" (handle) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10166
    self primitiveFailed.
9475
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
     |hPrinter rslt|
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10170
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10171
     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
 10172
     rslt := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10173
	    primDocumentProperties:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10174
	    hPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10175
	    pDeviceName: '\\http://exept.exept.de:631\lj4'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10176
	    pDevModeOutput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10177
	    pDevModeInput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10178
	    fMode:0.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10179
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10180
     self halt.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10181
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10182
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10183
    "Created: / 27-07-2006 / 19:30:50 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10184
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10185
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 10186
primGetDeviceCaps:hwndArg index: index
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10187
    "Returns driver specific information about the device"
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10188
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10189
    <apicall: int32 "GetDeviceCaps" (handle int32) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10190
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10191
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10192
    "Modified: / 01-08-2006 / 16:13:05 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10193
    "Modified: / 04-10-2006 / 11:38:06 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10194
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10195
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 10196
primGetPrinter:hwndArg level:index informationBuffer:informationBuffer bufferSize:bufferSize bufferNeededSize:bufferNeededSize
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10197
    <apicall: bool "GetPrinterA" (handle dword pointer dword pointer) module: "winspool.drv" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10198
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10199
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 10200
"
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10201
|hPrinter rslt printerName informationBuffer bytesNeeded sizeBytesArray ok|
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10202
     printerName := '\\http://exept.exept.de:631\lj4'.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10203
     hPrinter := self openPrinter: printerName .
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10204
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10205
     sizeBytesArray := ByteArray new:4.
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 10206
     ok := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10207
		primGetPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10208
		level:2
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10209
		informationBuffer: nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10210
		bufferSize: 0
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10211
		bufferNeededSize:sizeBytesArray.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10212
     bytesNeeded := sizeBytesArray longAt:1.
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10213
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10214
     informationBuffer := PrinterInfo2Structure new: bytesNeeded.
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 10215
     rslt := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10216
		primGetPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10217
		level:2
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10218
		informationBuffer:informationBuffer
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10219
		bufferSize: bytesNeeded
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10220
		bufferNeededSize:sizeBytesArray.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10221
     self assert: rslt.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10222
     informationBuffer inspect.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10223
     self closePrinter: printerName.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10224
"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10225
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10226
    "Modified: / 01-08-2006 / 12:39:26 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10227
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10228
11085
ff0e28fd7027 changed #primReleaseMutex:
fm
parents: 11084
diff changeset
 10229
primGetTextExtentPoint: handle string: lpString count: nCount size: pSize
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10230
    <apicall: bool "GetTextExtentPointA" (handle pointer int32 pointer) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10231
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10232
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10233
    "Created: / 03-08-2006 / 11:06:23 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10234
    "Modified: / 04-10-2006 / 11:38:21 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10235
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10236
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10237
primGetTextMetrics: deviceContext lpMetrics: textMetrics
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10238
    <apicall: bool "GetTextMetricsA" (handle pointer) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10239
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10240
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10241
    "Modified: / 02-08-2006 / 16:17:51 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10242
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10243
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10244
primOpenPrinter:name handleHolder:handleHolder ignored: ignored
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10245
    <apicall: bool "OpenPrinterA" ( lpstr lpstr lpstr ) module: "winspool.drv" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10246
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10247
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10248
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10249
     |h hh rslt|
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10250
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10251
     hh := ByteArray new:4.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10252
     rslt := self primOpenPrinter:'\\http://exept.exept.de:631\lj4' handleHolder:hh ignored: nil.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10253
     h := Win32Handle new setAddressFromBytes:hh.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10254
     self halt.
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10255
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10256
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10257
    "Created: / 27-07-2006 / 14:39:35 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10258
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10259
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 10260
primSetTextAlign:handle with:fMode
10180
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10261
    <apicall: bool "SetTextAlign" (handle int16) module: "gdi32.dll" >
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10262
    "SetTextAlign"
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10263
    "gdi32.dll"
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 10264
10180
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10265
    self primitiveFailed.
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10266
!
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10267
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10268
primSetViewportOrgEx: h x: x y: y oldOrigin: oldOrigin
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10269
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10270
    <apicall: bool "SetViewportOrgEx" (handle int16 int16 pointer) module: "gdi32.dll" >
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10271
    self primitiveFailed.
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10272
!
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10273
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 10274
primStartDoc:hwndArg docInfo: aDocInfo
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10275
    "Returns a jobId"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10276
    <apicall: int32 "StartDocA" (handle pointer) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10277
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10278
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10279
    "Modified: / 31-07-2006 / 11:47:10 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10280
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10281
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 10282
primStartPage:hwndArg
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10283
    <apicall: int32 "StartPage" (handle) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
 10284
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10285
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10286
    "Created: / 27-07-2006 / 19:02:12 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10287
    "Modified: / 31-07-2006 / 11:47:06 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10288
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10289
10180
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10290
setTextAlign: fMode to: handle
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10291
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10292
    self primSetTextAlign: handle with: fMode
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10293
!
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10294
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10295
setViewportOrg: h x: x y: y oldOrigin: oldOrigin
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10296
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10297
    self primSetViewportOrgEx: h x: x y: y oldOrigin: oldOrigin
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10298
!
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
 10299
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10300
startDoc: deviceContext docInfo: docInfoStruct
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10301
    ^self primStartDoc:deviceContext docInfo: docInfoStruct
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10302
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10303
    "Created: / 27-07-2006 / 19:42:39 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10304
    "Modified: / 04-10-2006 / 11:38:30 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10305
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10306
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10307
startPage: deviceContext
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10308
    ^self primStartPage:deviceContext
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10309
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10310
    "Created: / 27-07-2006 / 19:43:56 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10311
    "Modified: / 28-07-2006 / 18:48:58 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
 10312
    "Modified: / 04-10-2006 / 11:38:34 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10313
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 10314
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10315
!Win32OperatingSystem class methodsFor:'private'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10316
7777
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10317
mapLanguage:aWindowsLanguageString
9013
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10318
    "map a windows language string to ISO languageCode_languageTerritory format"
7777
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10319
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10320
    |windowsLanguageString|
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10321
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10322
    windowsLanguageString := aWindowsLanguageString asUppercase.
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10323
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10324
    #('DEU'     'de_DE'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10325
      'DES'     'de_CH'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10326
      'DEA'     'de_AT'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10327
      'DAN'     'da_DA'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10328
      'ENA'     'en_AU'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10329
      'ENC'     'en_CA'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10330
      'ENG'     'en_GB'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10331
      'ENI'     'en_IR'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10332
      'ENU'     'en_US'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10333
      'ENZ'     'en_NZ'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10334
      'FRA'     'fr_FR'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10335
      'FRB'     'fr_BE'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10336
      'FRC'     'fr_CA'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10337
      'FRS'     'fr_CH'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10338
      'ITA'     'it_IT'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10339
      'ITS'     'it_CH'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10340
      'ESM'     'es_MX'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10341
      'ESN'     'es_ES'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10342
      'ESP'     'es'            "Castillian"
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10343
      'NLB'     'nl_BE'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10344
      'NLD'     'nl_NL'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10345
      'CSY'     'cs_CS'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10346
      'ELL'     'el_EL'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10347
      'NON'     'no_NO'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10348
      'NOR'     'no_NO'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10349
     ) pairWiseDo:[:key :mappedValue|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10350
	key = windowsLanguageString ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10351
	    ^ mappedValue
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10352
	]
7777
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10353
    ].
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10354
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10355
    "no mapping"
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10356
    ^ windowsLanguageString.
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10357
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10358
    "
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
 10359
     self mapLanguage:'DEU'
7777
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10360
    "
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10361
!
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
 10362
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10363
osProcessStatusClass
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10364
    ^ OSProcessStatus
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10365
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10366
    "Created: / 12.6.1998 / 16:30:43 / cg"
20245
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
 10367
!
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
 10368
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
 10369
primExpandEnvironmentStringsA:inString into:outString size:outBuffer
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
 10370
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
 10371
    <apicall: ulongReturn "ExpandEnvironmentStringsA" (pointer pointer ulong) module: "kernel32.dll" >
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
 10372
    ^self primitiveFailed
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
 10373
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
 10374
    "
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
 10375
        self primExpandEnvironmentStringsA:'%ProgramFiles%\test\x' into:(String new:256) inspect size:256
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
 10376
    "
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
 10377
!
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
 10378
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
 10379
primExpandEnvironmentStringsW:inString into:outString size:outBuffer
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
 10380
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
 10381
    <apicall: ulongReturn "ExpandEnvironmentStringsW" (pointer pointer ulong) module: "kernel32.dll" >
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
 10382
    ^self primitiveFailed
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
 10383
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
 10384
    "
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
 10385
        self primExpandEnvironmentStringsW:'%ProgramFiles%\test\x' asUnicodeString into:(Unicode16String new:256) inspect size:256
0ea9c9caba33 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20174
diff changeset
 10386
    "
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10387
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10388
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10389
!Win32OperatingSystem class methodsFor:'regional settings'!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10390
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10391
country
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10392
	"Answer the current system value for country."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10393
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10394
    ^self queryNationalProfileString: 'iCountry' default: 0
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10395
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10396
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10397
	self country
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10398
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10399
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10400
    "Modified: / 22-12-2006 / 16:45:32 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10401
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10402
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10403
countryName
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10404
	"Answer the current system value for country name."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10405
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10406
    ^self queryNationalProfileString: 'sCountry' default: 'Deutschland'
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10407
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10408
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10409
	self countryName
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10410
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10411
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10412
    "Modified: / 22-12-2006 / 16:45:32 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10413
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10414
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10415
dateFormat
13324
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10416
    "Answer the current system value for date format.
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10417
     Answer DfMDY = Month-Day-Year
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10418
	    DfDMY = Day-Month-Year
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10419
	    DfYMD = Year-Month-Day."
13324
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10420
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10421
    |separatorString code|
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10422
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10423
    separatorString := self dateSeparator.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10424
13324
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10425
    code := self dateFormatCode.
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10426
    code = 0 ifTrue:[ ^ '%(mon)', separatorString, '%(day)', separatorString, '%(year)' ].
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10427
    code = 1 ifTrue:[ ^ '%(day)', separatorString, '%(mon)', separatorString, '%(year)' ].
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10428
    code = 2 ifTrue:[ ^ '%(year)', separatorString, '%(mon)', separatorString, '%(day)' ].
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10429
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10430
    ^ '%(day)', separatorString, '%(mon)', separatorString, '%(year)'
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10431
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10432
    "
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10433
     self dateFormat
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10434
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10435
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10436
    "Modified: / 22-12-2006 / 16:43:30 / User"
13324
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
 10437
    "Modified: / 28-03-2011 / 17:10:01 / cg"
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10438
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10439
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10440
dateFormatCode
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10441
	"Answer the current system value for date format.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10442
	 Answer DfMDY = Month-Day-Year = 0
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10443
		DfDMY = Day-Month-Year = 1
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10444
		DfYMD = Year-Month-Day = 2"
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10445
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10446
    ^self queryNationalProfileInt: 'iDate' default: 0
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10447
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10448
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10449
	self dateFormatCode
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
    "Modified: / 22-12-2006 / 16:45:53 / User"
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
dateSeparator
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10456
	"Answer the current system value for date separator."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10457
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10458
    ^self queryNationalProfileString: 'sDate' default: '/'
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10459
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10460
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10461
	self dateSeparator
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10462
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10463
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10464
    "Modified: / 22-12-2006 / 16:45:32 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10465
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10466
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10467
decimalSeparator
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10468
	"Answer the current system value for decimal separator."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10469
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10470
    ^self queryNationalProfileString: 'sDecimal' default: '.'
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10471
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10472
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10473
	self decimalSeparator
10968
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
    "Created: / 22-12-2006 / 16:45:11 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10477
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10478
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10479
isDateFormatDMY
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10480
	"Answer the current system value for date format.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10481
	 Answer DfMDY = Month-Day-Year
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10482
		DfDMY = Day-Month-Year
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10483
		DfYMD = Year-Month-Day."
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
    ^self dateFormatCode = 1
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10486
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10487
    "Created: / 18-01-2007 / 14:56:23 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10488
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10489
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10490
isDateFormatMDY
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10491
	"Answer the current system value for date format.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10492
	 Answer DfMDY = Month-Day-Year
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10493
		DfDMY = Day-Month-Year
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10494
		DfYMD = Year-Month-Day."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10495
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10496
    ^self dateFormatCode = 0
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: / 18-01-2007 / 14:56:07 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10499
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10500
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10501
isDateFormatYMD
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10502
	"Answer the current system value for date format.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10503
	 Answer DfMDY = Month-Day-Year
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10504
		DfDMY = Day-Month-Year
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10505
		DfYMD = Year-Month-Day."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10506
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10507
    ^self dateFormatCode = 2
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10508
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10509
    "Created: / 18-01-2007 / 14:56:30 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10510
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10511
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10512
isTimeFormat12Hour
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10513
	"Answer whether the current system time format is 12-hour."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10514
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10515
    ^self timeFormat = 0
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10516
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10517
    "Created: / 22-12-2006 / 16:48:17 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10518
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10519
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10520
primGetProfileInt: appName keyName: keyName default: anInt
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10521
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10522
    <apicall: uint32 "GetProfileIntA" ( lpstr lpstr uint32) module: "kernel32.dll" >
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10523
    ^self primitiveFailed
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10524
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10525
    "Created: / 22-12-2006 / 16:17:18 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10526
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10527
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10528
primGetProfileString: appName keyName: keyName default: defaultStr returnedString: retStr size: anInt
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10529
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10530
    <apicall: uint32 "GetProfileStringA" ( lpstr lpstr lpstr lpstr uint32) module: "kernel32.dll" >
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10531
    ^self primitiveFailed
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10532
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10533
    "Created: / 22-12-2006 / 16:20:23 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10534
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10535
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10536
queryNationalProfileInt: aKeyName default: defaultValue
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10537
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10538
    | answer |
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10539
    answer := self primGetProfileInt: 'Intl'
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10540
	keyName: aKeyName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10541
	default: -1 asUnsigned32.
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10542
    ^answer = -1 asUnsigned32
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10543
	ifTrue: [ defaultValue ]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10544
	ifFalse: [ answer ]
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10545
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10546
"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10547
    self queryNationalProfileInt: 'iDate' default: 0
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10548
"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10549
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10550
    "Modified: / 22-12-2006 / 16:23:05 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10551
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10552
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10553
queryNationalProfileString: aKeyName default: defaultValue
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10554
	"Answer the string value of key aKeyName in
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10555
	the [Intl] application section of the WIN.INI profile file.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10556
	Answer defaultValue if aKeyName cannot be found."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10557
    | extString result |
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10558
    extString := String new: 80.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10559
    result := self primGetProfileString: 'Intl'
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10560
	keyName: aKeyName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10561
	default: ''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10562
	returnedString: extString
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10563
	size: extString size.
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10564
    ^result > 0
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10565
	ifTrue: [extString copyFrom: 1 to: result]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10566
	ifFalse: [ defaultValue ]
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10567
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10568
    "Created: / 22-12-2006 / 16:13:01 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10569
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10570
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10571
thousandsSeparator
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10572
	"Answer the current system value
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10573
	for the thousands separator."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10574
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10575
    ^self queryNationalProfileString: 'sThousand' default: ','
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10576
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10577
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10578
	self thousandsSeparator
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10579
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10580
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10581
    "Created: / 22-12-2006 / 16:46:50 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10582
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10583
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10584
timeFormat
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10585
	"Answer the current system value for time format."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10586
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10587
    ^self queryNationalProfileInt: 'iTime' default: 0
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10588
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10589
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10590
	self timeFormat
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10591
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10592
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10593
    "Created: / 22-12-2006 / 16:48:27 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10594
! !
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
 10595
9093
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
 10596
!Win32OperatingSystem class methodsFor:'registry support'!
9013
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10597
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10598
registryEntry
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10599
    "provide access to the registryEntry class"
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10600
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10601
    ^ RegistryEntry
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10602
! !
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10603
9088
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 10604
!Win32OperatingSystem class methodsFor:'serial port support'!
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 10605
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 10606
serialPortAccessor
9093
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
 10607
    "provide access to the serial port class"
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
 10608
9088
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 10609
    ^ Win32SerialPortHandle
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 10610
! !
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 10611
9115
65f7004dae93 WIn32Shell and IUnknown stuff
Claus Gittinger <cg@exept.de>
parents: 9113
diff changeset
 10612
!Win32OperatingSystem class methodsFor:'shell operations'!
65f7004dae93 WIn32Shell and IUnknown stuff
Claus Gittinger <cg@exept.de>
parents: 9113
diff changeset
 10613
15472
2eb14b1eaf06 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15464
diff changeset
 10614
openApplicationForDocument:fileOrUrl operation:operationSymbol mimeType:mimeType
13108
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10615
    "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
 10616
     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
 10617
     html documents, pdf documents etc.
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10618
     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
 10619
	open
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10620
	edit
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10621
	explore
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10622
	print
15472
2eb14b1eaf06 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15464
diff changeset
 10623
    "
2eb14b1eaf06 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15464
diff changeset
 10624
2eb14b1eaf06 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15464
diff changeset
 10625
    self
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10626
	shellExecute:nil
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10627
	lpOperation:operationSymbol
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10628
	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
 10629
	lpParameters:nil
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10630
	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
 10631
	nShowCmd:#SW_SHOWNORMAL.
15472
2eb14b1eaf06 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15464
diff changeset
 10632
13108
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10633
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10634
    "
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10635
     self openApplicationForDocument: Filename currentDirectory operation:#open
15472
2eb14b1eaf06 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15464
diff changeset
 10636
     self openApplicationForDocument: 'C:\' operation:#open
13108
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10637
     self openApplicationForDocument: '..\..\doc\books\ArtOfSmalltalk\artMissing186187Fix1.pdf' asFilename operation:#open
15472
2eb14b1eaf06 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15464
diff changeset
 10638
     self openApplicationForDocument: 'http://www.exept.de' asFilename operation:#open
13108
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10639
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10640
     self openApplicationForDocument: 'C:\WINDOWS\Help\clipbrd.chm' asFilename operation:#open
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10641
    "
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10642
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10643
    "Created: / 04-08-2006 / 18:04:52 / fm"
13284
d3828897bd5b comment/format in: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 13224
diff changeset
 10644
    "Modified: / 05-02-2011 / 16:25:31 / cg"
13223
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 10645
! !
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 10646
9093
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
 10647
!Win32OperatingSystem class methodsFor:'socket support'!
8270
df0083a70225 temporary kludge for SOcketAccessor/SocketHandle
ca
parents: 8265
diff changeset
 10648
df0083a70225 temporary kludge for SOcketAccessor/SocketHandle
ca
parents: 8265
diff changeset
 10649
socketAccessor
9093
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
 10650
    "provide access to the socket handle class"
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
 10651
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 10652
    ^ Win32SocketHandle
8270
df0083a70225 temporary kludge for SOcketAccessor/SocketHandle
ca
parents: 8265
diff changeset
 10653
! !
df0083a70225 temporary kludge for SOcketAccessor/SocketHandle
ca
parents: 8265
diff changeset
 10654
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10655
!Win32OperatingSystem class methodsFor:'system management'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10656
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10657
exitWindows
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10658
    "do not use - may be removed without notice"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10659
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10660
    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
 10661
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10662
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10663
exitWindows:how confirm:confirmationMessageOrNil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10664
    "this method is temporary -
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10665
     since my windows system menu crashes so often
7850
087b4ca01736 comment & unneeded method removed
ca
parents: 7841
diff changeset
 10666
     (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
 10667
     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
 10668
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10669
    confirmationMessageOrNil notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10670
	(Dialog confirm:confirmationMessageOrNil) ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10671
	    ^ false
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10672
	].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10673
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10674
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10675
    int flag;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10676
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10677
    if (how == @symbol(shutdown)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10678
	flag = EWX_SHUTDOWN;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10679
    } else if (how == @symbol(reboot)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10680
	flag = EWX_REBOOT;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10681
    } else if (how == @symbol(logoff)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10682
	flag = EWX_LOGOFF;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10683
    } else if (how == @symbol(forceShutdown)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10684
	flag = EWX_SHUTDOWN | EWX_FORCE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10685
    } else if (how == @symbol(forceReboot)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10686
	flag = EWX_REBOOT | EWX_FORCE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10687
    } else if (how == @symbol(forceLogoff)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10688
	flag = EWX_LOGOFF | EWX_FORCE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10689
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10690
	RETURN (false);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10691
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10692
    RETURN ((ExitWindowsEx(flag, 0) == TRUE) ? true : false);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10693
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10694
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10695
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10696
!Win32OperatingSystem class methodsFor:'time and date'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10697
17006
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10698
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
 10699
    "return the OS-dependent time for the given time and day.
17006
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10700
     The arguments are assumed to be in localtime including
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10701
     any daylight saving adjustings."
8640
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
 10702
17009
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10703
    |osTime|
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10704
8640
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
 10705
%{
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
 10706
    if (__bothSmallInteger(y, m)
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
 10707
     && __bothSmallInteger(d, h)
12934
bc516945ce4d changed:
Claus Gittinger <cg@exept.de>
parents: 12908
diff changeset
 10708
     && __bothSmallInteger(min, s)
bc516945ce4d changed:
Claus Gittinger <cg@exept.de>
parents: 12908
diff changeset
 10709
     && __isSmallInteger(millis)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10710
	SYSTEMTIME sysTime;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10711
	FILETIME fileTime;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10712
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10713
	sysTime.wHour = __intVal(h);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10714
	sysTime.wMinute = __intVal(min);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10715
	sysTime.wSecond = __intVal(s);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10716
	sysTime.wMilliseconds = __intVal(millis);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10717
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10718
	sysTime.wYear = __intVal(y);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10719
	sysTime.wMonth = __intVal(m);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10720
	sysTime.wDay = __intVal(d);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10721
17006
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10722
	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
 10723
	if (sysTime.wYear > 9999) goto outOfRange;
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10724
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10725
	if (utcBoolean != true) {
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10726
	    // adjust for local time
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10727
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10728
	    // TzSpecificLocalTimeToSystemTime() is not supported in Win2000
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10729
	    // - but we do not support Win2k any longer as of 2014
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10730
#ifdef __BORLANDC__
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10731
	    {
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10732
		typedef BOOL (WINAPI *P_TzSpecificLocalTimeToSystemTime)(LPTIME_ZONE_INFORMATION, LPSYSTEMTIME, LPSYSTEMTIME);
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10733
		static P_TzSpecificLocalTimeToSystemTime pTzSpecificLocalTimeToSystemTime;
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10734
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10735
		if (pTzSpecificLocalTimeToSystemTime == NULL) {
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10736
		    pTzSpecificLocalTimeToSystemTime =
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10737
			(P_TzSpecificLocalTimeToSystemTime)
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10738
			    GetProcAddress ( GetModuleHandle ("kernel32.dll"),
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10739
							      "TzSpecificLocalTimeToSystemTime");
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10740
		}
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10741
		if (!pTzSpecificLocalTimeToSystemTime(0, &sysTime, &sysTime))
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10742
		    goto error;
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10743
	    }
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10744
#else
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10745
	    if (!TzSpecificLocalTimeToSystemTime(0, &sysTime, &sysTime))
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10746
		goto error;
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10747
#endif
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10748
	}
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10749
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10750
	if (! SystemTimeToFileTime(&sysTime, &fileTime))
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10751
	    goto error;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10752
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 10753
	osTime = FileTimeToOsTime1970(&fileTime);
9384
5c5dd48a9fdd Fix localTime / utcTime conversion
Stefan Vogel <sv@exept.de>
parents: 9381
diff changeset
 10754
    }
17006
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10755
outOfRange: ;
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10756
error: ;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10757
%}.
17009
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10758
    osTime notNil ifTrue:[
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10759
	"/ 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
 10760
	"/ ^ osTime - self osTimeOf19700101. -- already done
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 10761
	^ osTime
17009
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10762
    ].
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10763
12821
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
 10764
    "Error, some invalid date ot time"
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
 10765
    ^ TimeConversionError raiseRequest
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10766
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10767
    "
12820
bb674e2ebc2a changed:
Stefan Vogel <sv@exept.de>
parents: 12818
diff changeset
 10768
     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
 10769
     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
 10770
     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
 10771
    "
12934
bc516945ce4d changed:
Claus Gittinger <cg@exept.de>
parents: 12908
diff changeset
 10772
bc516945ce4d changed:
Claus Gittinger <cg@exept.de>
parents: 12908
diff changeset
 10773
    "Modified: / 07-07-2010 / 16:56:56 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10774
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10775
17007
48b4d45626c9 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 17006
diff changeset
 10776
epochEndOSTime
48b4d45626c9 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 17006
diff changeset
 10777
    "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
 10778
     (in milliseconds since the Unix epoch, 1.1.1970) is."
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10779
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10780
    "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
 10781
     to 16r7FFFFFFFFFFFFFFF."
19666
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10782
    "/ ^ (16r7FFFFFFFFFFFFFFF // 10000) - self osTimeOf19700101
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10783
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10784
    "/ 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
 10785
    ^ (SmallInteger maxVal * 2 + 1) * 1000
17007
48b4d45626c9 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 17006
diff changeset
 10786
!
48b4d45626c9 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 17006
diff changeset
 10787
48b4d45626c9 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 17006
diff changeset
 10788
epochStartOSTime
48b4d45626c9 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 17006
diff changeset
 10789
    "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
 10790
     (in milliseconds since the Unix epoch, 1.1.1970) is."
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10791
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10792
    "Windows epoch starts at 1.1.1601."
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10793
    "/ ^ self osTimeOf19700101 negated
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10794
755edabcbe67 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19653
diff changeset
 10795
    "/ 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
 10796
    ^ 0
17007
48b4d45626c9 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 17006
diff changeset
 10797
!
48b4d45626c9 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 17006
diff changeset
 10798
11746
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10799
getMicrosecondTime
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10800
    "This returns a microsecond timer value.
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10801
     The returned value is a 64bit value
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10802
     (which is the number of microseconds since the system's boot time -
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10803
      but you should not depend on that because it is system specific.
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10804
     Only use for relative delta-times."
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10805
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10806
%{  /* NOCONTEXT */
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10807
    static int frequencyKnown = 0;
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10808
    static LONGLONG ticksPerSecond;
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10809
    static LONGLONG divisor;
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10810
    LONGLONG tick;     // A point in time
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 10811
    LONGLONG micros;
11746
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10812
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10813
    if (! frequencyKnown) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10814
	// get the high resolution counter's accuracy
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10815
	QueryPerformanceFrequency(&ticksPerSecond);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10816
	frequencyKnown = 1;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10817
	divisor = ticksPerSecond / (LONGLONG)1000000;
11746
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10818
    }
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10819
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10820
    // what time is it?
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10821
    QueryPerformanceCounter(&tick);
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10822
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10823
    micros = tick / divisor;
12821
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
 10824
    RETURN ( __MKLARGEINT64(1, (micros & 0xFFFFFFFF), (micros >> 32)) );
11746
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10825
%}
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10826
    "
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10827
     |t1 t2 dT|
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10828
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10829
     t1 := self getMicrosecondTime.
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10830
     Delay waitForSeconds:1.
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10831
     t2 := self getMicrosecondTime.
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 10832
     dT := t2 - t1
11746
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10833
    "
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10834
    "
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10835
     |t1 t2 dT|
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10836
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10837
     t1 := self getMillisecondTime.
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10838
     Delay waitForSeconds:1.
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10839
     t2 := self getMillisecondTime.
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 10840
     dT := t2 - t1
11746
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10841
    "
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10842
!
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10843
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10844
getMillisecondTime
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 10845
    "This returns the millisecond timers value.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10846
     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
 10847
     LargeInteger arithmetic when doing timeouts and delays.
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 10848
     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
 10849
     this can only be used for short relative time deltas.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10850
     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
 10851
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10852
     BAD DESIGN:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10853
	This should be changed to return some instance of RelativeTime,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10854
	and these computations moved there.
11800
bfd3073ef9d2 #getMillisecondTime - comment
Stefan Vogel <sv@exept.de>
parents: 11779
diff changeset
 10855
bfd3073ef9d2 #getMillisecondTime - comment
Stefan Vogel <sv@exept.de>
parents: 11779
diff changeset
 10856
     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
 10857
     interface. For compatibility with ST-80, use Time millisecondClockValue.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10858
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10859
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10860
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10861
12838
9b773959a7c7 changed: #getMillisecondTime
Stefan Vogel <sv@exept.de>
parents: 12837
diff changeset
 10862
    RETURN ( __mkSmallInteger(GetTickCount() & 0x1FFFFFFF) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10863
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10864
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10865
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10866
getOSTime
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10867
    "This returns the OS time.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10868
     The base of the returned value is not consistent across
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10869
     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
 10870
     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
 10871
     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
 10872
     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
 10873
9a1173183b4c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16474
diff changeset
 10874
     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
 10875
     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
 10876
     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
 10877
17009
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10878
    |osTime|
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10879
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10880
%{
12817
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10881
    FILETIME fileTime;
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10882
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10883
    GetSystemTimeAsFileTime(&fileTime);
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 10884
    osTime = FileTimeToOsTime1970(&fileTime);
17009
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10885
%}.
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 10886
    "/ 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
 10887
    "/ ^ osTime - self osTimeOf19700101 -- already done.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 10888
    ^ osTime
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10889
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10890
    "
12817
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10891
     OperatingSystem getOSTime.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10892
     Delay waitForSeconds:0.2.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10893
     OperatingSystem getOSTime printCR.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10894
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10895
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10896
11842
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10897
getTimezoneInformation
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10898
    "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
 10899
     AbstractOperatingSystem::TimeZoneInformation for details"
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10900
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 10901
    ^ self getTimezoneInformationForYear:nil.
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10902
11842
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10903
    "
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10904
     self getTimezoneInformation
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10905
    "
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10906
!
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10907
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10908
getTimezoneInformationForYear:anIntegerOrNil
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10909
    "get information about the OS's timezone setting. See documentation in
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10910
     AbstractOperatingSystem::TimeZoneInformation for details"
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10911
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10912
    |error bias standardName
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10913
     standardDate_y standardDate_m standardDate_d standardDate_wd
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10914
     standardDate_h standardDate_min standardDate_s
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10915
     standardBias
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10916
     daylightName
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10917
     daylightDate_y daylightDate_m daylightDate_d daylightDate_wd
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10918
     daylightDate_h daylightDate_min daylightDate_s
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10919
     daylightBias info|
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
%{
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10922
    TIME_ZONE_INFORMATION tzInfo;
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10923
    DWORD retVal;
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10924
    WCHAR nm[33];
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
    if (anIntegerOrNil == nil) {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10927
	retVal = GetTimeZoneInformation(&tzInfo);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10928
	switch (retVal) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10929
	    case TIME_ZONE_ID_STANDARD:
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10930
	    case TIME_ZONE_ID_DAYLIGHT:
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10931
	    case TIME_ZONE_ID_UNKNOWN:
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10932
		break;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10933
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10934
	    default:
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10935
	    case TIME_ZONE_ID_INVALID:
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10936
		error = __mkSmallInteger(__WIN32_ERR(GetLastError()));
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10937
		goto out;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10938
	}
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10939
    } else if (__isSmallInteger(anIntegerOrNil)) {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10940
	int year = __intVal(anIntegerOrNil);
18628
6d7c70420471 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18548
diff changeset
 10941
#if defined(__BORLANDC__) || defined(__MINGW32__)
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10942
	{
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10943
	    typedef BOOL (WINAPI *P_GetTimeZoneInformationForYear)(
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10944
					USHORT,
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10945
					LPTIME_ZONE_INFORMATION, // - should be, but is not defined: PDYNAMIC_TIME_ZONE_INFORMATION,
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10946
					LPTIME_ZONE_INFORMATION);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10947
	    static P_GetTimeZoneInformationForYear pGetTimeZoneInformationForYear;
18629
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 10948
	    static int haveTriedToGet_P_GetTimeZoneInformationForYear = 0;
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 10949
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 10950
	    if (! haveTriedToGet_P_GetTimeZoneInformationForYear) {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10951
		pGetTimeZoneInformationForYear =
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10952
		    (P_GetTimeZoneInformationForYear)GetProcAddress(GetModuleHandle("kernel32.dll"), "GetTimeZoneInformationForYear");
18629
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 10953
		haveTriedToGet_P_GetTimeZoneInformationForYear = 1;
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 10954
	    }
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 10955
	    if (pGetTimeZoneInformationForYear == NULL) {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10956
		error = __mkSmallInteger(@symbol(primitiveFailed));
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10957
		goto out;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10958
	    } else {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10959
		if (!pGetTimeZoneInformationForYear(year, NULL, &tzInfo)) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10960
		    error = __mkSmallInteger(__WIN32_ERR(GetLastError()));
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10961
		    goto out;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10962
		}
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10963
	    }
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10964
	}
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10965
#else
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10966
	if (!GetTimeZoneInformationForYear(year, NULL, &tzInfo)) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10967
	    error = __mkSmallInteger(__WIN32_ERR(GetLastError()));
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10968
	    goto out;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10969
	}
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10970
#endif
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10971
    } else {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10972
	error = @symbol(badArgument);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 10973
	goto out;
17006
d6ec5e448ac5 timestamp changes
Claus Gittinger <cg@exept.de>
parents: 17004
diff changeset
 10974
    }
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10975
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10976
    bias = __mkSmallInteger(tzInfo.Bias);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10977
    memmove(nm, tzInfo.StandardName, 32*sizeof(WCHAR));
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10978
    nm[32] = 0;
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10979
    standardName = __MKU16STRING(nm);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10980
    standardDate_y = __mkSmallInteger(tzInfo.StandardDate.wYear);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10981
    standardDate_m = __mkSmallInteger(tzInfo.StandardDate.wMonth);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10982
    standardDate_d = __mkSmallInteger(tzInfo.StandardDate.wDay);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10983
    standardDate_wd = __mkSmallInteger(tzInfo.StandardDate.wDayOfWeek);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10984
    standardDate_h = __mkSmallInteger(tzInfo.StandardDate.wHour);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10985
    standardDate_min = __mkSmallInteger(tzInfo.StandardDate.wMinute);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10986
    standardDate_s = __mkSmallInteger(tzInfo.StandardDate.wSecond);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10987
    standardBias =  __mkSmallInteger(tzInfo.StandardBias);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10988
    memmove(nm, tzInfo.DaylightName, 32*sizeof(WCHAR));
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10989
    nm[32] = 0;
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10990
    daylightName = __MKU16STRING(nm);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10991
    daylightDate_y = __mkSmallInteger(tzInfo.DaylightDate.wYear);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10992
    daylightDate_m = __mkSmallInteger(tzInfo.DaylightDate.wMonth);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10993
    daylightDate_d = __mkSmallInteger(tzInfo.DaylightDate.wDay);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10994
    daylightDate_wd = __mkSmallInteger(tzInfo.DaylightDate.wDayOfWeek);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10995
    daylightDate_h = __mkSmallInteger(tzInfo.DaylightDate.wHour);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10996
    daylightDate_min = __mkSmallInteger(tzInfo.DaylightDate.wMinute);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10997
    daylightDate_s = __mkSmallInteger(tzInfo.DaylightDate.wSecond);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10998
    daylightBias =  __mkSmallInteger(tzInfo.DaylightBias);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 10999
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11000
out:;
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11001
%}.
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11002
    error notNil ifTrue:[
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11003
	self primitiveFailed:error.
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11004
    ].
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11005
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11006
    info := self timeZoneInfoClass new.
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11007
    info
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11008
	bias:bias
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11009
	name:standardName standardBias:standardBias
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11010
	daylightName:daylightName daylightBias:daylightBias.
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11011
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11012
    standardDate_m ~~ 0 ifTrue:[
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11013
	info standardYear:standardDate_y standardMonth:standardDate_m standardDay:standardDate_d
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11014
	     standardWeekDay:standardDate_wd standardHour:standardDate_h standardMinute:standardDate_min.
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11015
    ].
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11016
    daylightDate_m ~~ 0 ifTrue:[
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11017
	info daylightYear:daylightDate_y daylightMonth:daylightDate_m daylightDay:daylightDate_d
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11018
	     daylightWeekDay:daylightDate_wd daylightHour:daylightDate_h daylightMinute:daylightDate_min.
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11019
    ].
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11020
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11021
    ^ info
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11022
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11023
    "
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11024
     self getTimezoneInformationForYear:2014
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11025
     self getTimezoneInformationForYear:2015
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11026
     self getTimezoneInformationForYear:1977
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11027
     self getTimezoneInformationForYear:nil
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11028
    "
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11029
!
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11030
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11031
osTimeOf19700101
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11032
    "the number of millis from 1.1.1601 to 1.1.1970"
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11033
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11034
    ^ 11644473600000
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11035
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11036
    "
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11037
      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
 11038
    "
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11039
!
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11040
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11041
sleep:numberOfSeconds
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11042
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11043
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11044
    "cease ANY action for some time. This suspends the whole smalltalk
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11045
     (unix-) process for some time.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11046
     Not really useful since not even low-prio processes and interrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11047
     handling will run during the sleep.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11048
     Use either OperatingSystem>>millisecondDelay: (which makes all
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11049
     threads sleep, but handles interrupts) or use a Delay (which makes
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11050
     only the calling thread sleep)."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11051
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11052
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11053
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11054
    if (__isSmallInteger(numberOfSeconds)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11055
	sleep(__intVal(numberOfSeconds));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11056
	RETURN ( self );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11057
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11058
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11059
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11060
     argument not integer
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11061
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11062
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11063
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11064
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11065
     OperatingSystem sleep:2
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11066
    "
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 11067
!
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 11068
17042
f381b63198e1 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 17023
diff changeset
 11069
timeInfoFromSeconds:osSeconds milliseconds:osMilliSeconds localTime:isLocalTime
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11070
    "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
 11071
     An internal helper"
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 11072
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11073
    |year month day hour minute second millis utcOffset isDst
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11074
     dst yDay weekDay info reason tLow tHigh t error |
17009
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 11075
19653
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
 11076
    t := (osSeconds * 1000) + osMilliSeconds "+ self osTimeOf19700101 -- done in C".
17009
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 11077
    tLow := (t bitAnd:16rFFFFFFFF).
fe717d5312a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 17007
diff changeset
 11078
    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
 11079
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 11080
%{
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11081
    FILETIME fileTime;
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11082
    SYSTEMTIME sysTime, *sysTimePtr;
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11083
    INT _utcOffset, _stdUtcOffset;
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 11084
8889
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
 11085
    /* try cache */
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
 11086
    {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11087
	OBJ lastOsTimeLow, lastOsTimeHi, lastTimeInfo;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11088
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11089
	lastOsTimeLow = @global(LastOsTimeLow);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11090
	lastOsTimeHi = @global(LastOsTimeHi);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11091
	if (__isInteger(lastOsTimeLow)
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11092
	     && (__unsignedLongIntVal(lastOsTimeLow) == __unsignedLongIntVal(tLow))
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11093
	     && lastOsTimeHi
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11094
	     && (__unsignedLongIntVal(lastOsTimeHi) == __unsignedLongIntVal(tHigh))
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11095
	     && (@global(LastTimeInfoIsLocal) == isLocalTime)
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11096
	) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11097
	    lastTimeInfo = @global(LastTimeInfo);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11098
	    if (lastTimeInfo != nil) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11099
		RETURN (lastTimeInfo);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11100
	    }
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11101
	}
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11102
    }
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11103
19653
ad5ce2d82380 more rebiasing of times
Claus Gittinger <cg@exept.de>
parents: 19651
diff changeset
 11104
    if (!OsTime1970ToFileTime(tLow, tHigh, &fileTime))
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11105
	goto out;
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11106
    if (!FileTimeToSystemTime(&fileTime, &sysTime))
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11107
	goto out;
16948
45832ec999e2 method name cleanup
Claus Gittinger <cg@exept.de>
parents: 16947
diff changeset
 11108
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11109
    if (isLocalTime == false) { // easy: UTC time
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11110
	sysTimePtr = &sysTime;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11111
	utcOffset = __mkSmallInteger(0);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11112
	isDst = false;
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11113
    } else {  // local time: have to convert and find out about DST
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11114
	TIME_ZONE_INFORMATION tzInfo;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11115
	LONGLONG longTime;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11116
	SYSTEMTIME localSysTime;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11117
	FILETIME localFileTime;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11118
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11119
	sysTimePtr = &localSysTime;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11120
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11121
	if (!SystemTimeToTzSpecificLocalTime(NULL, &sysTime, &localSysTime))
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11122
	    goto out;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11123
	if (!SystemTimeToFileTime(&localSysTime, &localFileTime))
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11124
	    goto out;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11125
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11126
	// all the rest is computing the UTC offset and whether DST applies
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11127
	longTime = ((LONGLONG)fileTime.dwHighDateTime << 32) + fileTime.dwLowDateTime;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11128
	longTime -= ((LONGLONG)localFileTime.dwHighDateTime << 32) + localFileTime.dwLowDateTime;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11129
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11130
	// utcOffset is the difference from UTC to local time including possible DST
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11131
	_utcOffset = longTime / 10000000;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11132
	utcOffset = __mkSmallInteger(_utcOffset);
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11133
18629
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 11134
# if defined(__BORLANDC__) || defined(__MINGW32__)
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11135
	{
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11136
	    typedef BOOL (WINAPI *P_GetTimeZoneInformationForYear)(
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11137
					USHORT,
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11138
					LPTIME_ZONE_INFORMATION, // - should be, but is not defined: PDYNAMIC_TIME_ZONE_INFORMATION,
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11139
					LPTIME_ZONE_INFORMATION);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11140
	    static P_GetTimeZoneInformationForYear pGetTimeZoneInformationForYear;
18629
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 11141
	    static int haveTriedToGet_P_GetTimeZoneInformationForYear = 0;
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 11142
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 11143
	    if (! haveTriedToGet_P_GetTimeZoneInformationForYear) {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11144
		pGetTimeZoneInformationForYear =
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11145
		    (P_GetTimeZoneInformationForYear)GetProcAddress(GetModuleHandle("kernel32.dll"), "GetTimeZoneInformationForYear");
18629
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 11146
		haveTriedToGet_P_GetTimeZoneInformationForYear = 1;
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 11147
	    }
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 11148
	    if (pGetTimeZoneInformationForYear == NULL) {
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 11149
		// ignore this error and fall back to GetTimeZoneInformation()
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 11150
		reason = @symbol(NoGetTimeZoneInformationForYear);
b38434722f21 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18628
diff changeset
 11151
	    } else {
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11152
		if (pGetTimeZoneInformationForYear(localSysTime.wYear, NULL, &tzInfo)) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11153
		    _stdUtcOffset = (tzInfo.Bias + tzInfo.StandardBias) * 60;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11154
		    isDst = (_stdUtcOffset != _utcOffset) ? true : false;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11155
		} else {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11156
		    // ignore this error and fall back to GetTimeZoneInformation()
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11157
		    reason = @symbol(GetTimeZoneInformationForYearFailed);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11158
		    error = __mkSmallInteger(__WIN32_ERR(GetLastError()));
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11159
		}
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11160
	    }
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11161
	}
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11162
# else
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11163
	if (GetTimeZoneInformationForYear(localSysTime.wYear, NULL, &tzInfo)) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11164
	    _stdUtcOffset = (tzInfo.Bias + tzInfo.StandardBias) * 60;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11165
	    isDst = (_stdUtcOffset != _utcOffset) ? true : false;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11166
	} else {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11167
	    // ignore this error and fall back to GetTimeZoneInformation()
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11168
	    reason = @symbol(GetTimeZoneInformationForYearFailed);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11169
	    error = __mkSmallInteger(__WIN32_ERR(GetLastError()));
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11170
	}
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11171
# endif
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11172
	// this code is a fallback for WIN XP
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11173
	if (isDst == nil) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11174
	    DWORD retVal = GetTimeZoneInformation(&tzInfo);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11175
	    switch (retVal) {
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11176
		case TIME_ZONE_ID_STANDARD:
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11177
		case TIME_ZONE_ID_DAYLIGHT:
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11178
		case TIME_ZONE_ID_UNKNOWN:
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11179
		    // nonDstOffset is the difference from UTC to local time without DST
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11180
		    _stdUtcOffset = (tzInfo.Bias + tzInfo.StandardBias) * 60;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11181
		    isDst = (_stdUtcOffset != _utcOffset) ? true : false;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11182
		    break;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11183
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11184
		// these are errors, which may occur, if the
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11185
		// Windows OS has not been setupm correctly.
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11186
		// We ignore these errors here, but we don't know if DST applies.
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11187
		// Assume that there is no DST.
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11188
		default:
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11189
		case TIME_ZONE_ID_INVALID:
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11190
		    isDst = false;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11191
		    reason = @symbol(TIME_ZONE_ID_INVALID);
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11192
		    error = __mkSmallInteger(__WIN32_ERR(GetLastError()));
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11193
		    break;
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11194
	    }
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11195
	}  // End WINXP backward compatibility
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11196
    }
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11197
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11198
    hour = __mkSmallInteger(sysTimePtr->wHour);
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11199
    minute = __mkSmallInteger(sysTimePtr->wMinute);
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11200
    second = __mkSmallInteger(sysTimePtr->wSecond);
17004
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11201
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11202
    year = __mkSmallInteger(sysTimePtr->wYear);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11203
    month = __mkSmallInteger(sysTimePtr->wMonth);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11204
    day = __mkSmallInteger(sysTimePtr->wDay);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11205
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11206
    millis = __mkSmallInteger(sysTimePtr->wMilliseconds);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11207
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11208
    weekDay = __mkSmallInteger(sysTimePtr->wDayOfWeek == 0 ? 7 : sysTimePtr->wDayOfWeek);
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11209
out:;
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 11210
%}.
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11211
"/    '--> REASON: ' errorPrint. reason errorPrintCR. '--> ERROR: ' errorPrint. error errorPrintCR.
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11212
12817
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 11213
    year isNil ifTrue:[
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11214
	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
 11215
    ].
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 11216
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 11217
    info := self timeInfoClass new.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 11218
    info
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11219
	year:year
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11220
	month:month
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11221
	day:day
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11222
	hours:hour
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11223
	minutes:minute
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11224
	seconds:second
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11225
	milliseconds:millis
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11226
	utcOffset:utcOffset
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11227
	dst:isDst
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11228
	dayInYear:yDay
a7170033e17f directory access
ca
parents: 17169
diff changeset
 11229
	dayInWeek:weekDay.
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
 11230
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
 11231
    LastTimeInfo := info.
16948
45832ec999e2 method name cleanup
Claus Gittinger <cg@exept.de>
parents: 16947
diff changeset
 11232
    LastOsTimeLow := tLow.
45832ec999e2 method name cleanup
Claus Gittinger <cg@exept.de>
parents: 16947
diff changeset
 11233
    LastOsTimeHi := tHigh.
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
 11234
    LastTimeInfoIsLocal := isLocalTime.
8889
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
 11235
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 11236
    ^ info
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 11237
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 11238
    "
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11239
    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
 11240
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11241
    DST in MEZ in 1994:
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11242
      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
 11243
504c08a32877 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16951
diff changeset
 11244
     no DST in MEZ in 1970:
17169
fee0dd6ff671 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17117
diff changeset
 11245
      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
 11246
    "
9431
cae760dd7d80 oops: localtime and gmtime could return a NULL-ptr.
Claus Gittinger <cg@exept.de>
parents: 9424
diff changeset
 11247
cae760dd7d80 oops: localtime and gmtime could return a NULL-ptr.
Claus Gittinger <cg@exept.de>
parents: 9424
diff changeset
 11248
    "Modified: / 06-07-2006 / 18:18:56 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11249
! !
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
!Win32OperatingSystem class methodsFor:'users & groups'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11252
12970
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11253
getApplicationDataDirectoryFor:appName
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11254
    "return the directory, where user-and-application-specific private files are to be
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11255
     located (ini-files, preferences etc.).
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11256
     Under windows, something like 'C:\Users\Administrator\AppData\Roaming\<appName>'
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11257
     is returned, here, the fallback ~/.<appName> is returned.
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11258
     Notice that only the name is returned; the directory is not guaranteed to exist."
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11259
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11260
    "{ Pragma: +optSpace }"
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11261
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11262
    |appDataDirFromEnv appDataDirFromRegistry|
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11263
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11264
    appDataDirFromEnv := self getEnvironment:'APPDATA'.
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11265
    appDataDirFromEnv notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11266
	^ appDataDirFromEnv , '\' , appName
13128
35def02e40f4 CloseHandle added in: getAllProcesses
Michael Beyl <mb@exept.de>
parents: 13114
diff changeset
 11267
    ].
35def02e40f4 CloseHandle added in: getAllProcesses
Michael Beyl <mb@exept.de>
parents: 13114
diff changeset
 11268
    appDataDirFromRegistry :=
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11269
	(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
 11270
	    valueNamed:'AppData'.
12970
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11271
    appDataDirFromRegistry notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11272
	^ appDataDirFromRegistry , '\' , appName
12970
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11273
    ].
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11274
    ^ super getApplicationDataDirectoryFor:appName
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11275
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11276
    "
13128
35def02e40f4 CloseHandle added in: getAllProcesses
Michael Beyl <mb@exept.de>
parents: 13114
diff changeset
 11277
     OperatingSystem getApplicationDataDirectoryFor:'expecco'
12970
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11278
    "
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11279
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11280
    "Created: / 29-07-2010 / 12:13:12 / sr"
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11281
!
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 11282
10541
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11283
getDesktopDirectory
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11284
    "return the name of the users desktop directory (i.e. yours)."
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11285
10541
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11286
    "{ Pragma: +optSpace }"
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11287
10543
442329e05841 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10542
diff changeset
 11288
    |dir path|
10541
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11289
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 11290
    path := (self registryEntry
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11291
		key:'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders')
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11292
	    valueNamed:'Desktop'.
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 11293
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 11294
    path isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11295
	"Fallback"
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11296
	dir := self getHomeDirectory.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11297
	dir isNil ifTrue:[ ^ nil ].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11298
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11299
	path := dir , '\Desktop'.
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11300
    ].
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11301
10627
bef737d1b8a7 care for -1 fd returned by CreatePipe
Claus Gittinger <cg@exept.de>
parents: 10622
diff changeset
 11302
    (self isValidPath:path) ifFalse:[ ^ nil ].
10541
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11303
    ^ path
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11304
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11305
    "
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11306
     OperatingSystem getDesktopDirectory
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11307
    "
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11308
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11309
    "Created: / 16-05-2007 / 13:23:43 / cg"
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11310
!
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 11311
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11312
getDocumentsDirectory
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11313
    "return the name of the users 'Documents' directory."
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11314
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11315
    "{ Pragma: +optSpace }"
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11316
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11317
    |dir|
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11318
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 11319
    dir := (self registryEntry
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11320
		key:'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders')
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11321
	    valueNamed:'Personal'.
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11322
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11323
    dir isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11324
	dir := self getHomeDirectory.
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11325
    ].
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11326
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11327
    ^ dir.
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11328
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11329
    "
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11330
     OperatingSystem getDocumentsDirectory
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
!
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11333
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11334
getEffectiveGroupID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11335
    "{ Pragma: +optSpace }"
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
    "return the current users (thats you) effective numeric group id.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11338
     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
 11339
     as a setuid program (of which you should think about twice)."
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
    ^ self getGroupID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11342
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
     OperatingSystem getEffectiveGroupID
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
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11347
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11348
getEffectiveUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11349
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11350
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11351
    "return the current users (thats you) effective numeric user id.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11352
     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
 11353
     as a setuid program (of which you should think about twice)."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11354
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11355
    ^ self getUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11356
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11357
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11358
     OperatingSystem getEffectiveUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11359
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11360
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11361
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11362
getFullUserNameFromID:userID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11363
    "{ Pragma: +optSpace }"
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
    "return a string with the users full name - if available.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11366
     If not, return the login name as a fallBack."
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
    |info gecos|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11369
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11370
    info := self userInfoOf:userID.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11371
    (info notNil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11372
    and:[info includesKey:#gecos]) ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11373
	gecos := info at:#gecos.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11374
	(gecos includes:$,) ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11375
	    ^ gecos copyTo:(gecos indexOf:$,) - 1
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11376
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11377
	^ gecos
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11378
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11379
    ^ self getUserNameFromID:userID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11380
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11381
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 11382
     OperatingSystem getFullUserNameFromID:0
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 11383
     OperatingSystem getFullUserNameFromID:(OperatingSystem getUserID)
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 11384
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 11385
     OperatingSystem getUserNameFromID:(OperatingSystem getUserID)
5133
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11388
    "Modified: 15.7.1996 / 12:44:21 / cg"
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
getGroupID
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 group 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 groupIDs"
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 getGroupID
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
getGroupNameFromID: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 group-name-string for a given numeric group-id"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11407
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11408
    ^ '???' "just a dummy for systems which do not have groupIDs"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11409
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11410
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11411
     OperatingSystem getGroupNameFromID:0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11412
     OperatingSystem getGroupNameFromID:10
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11413
    "
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
getHomeDirectory
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11417
    "return the name of the users home directory (i.e. yours)."
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11418
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11419
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11420
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11421
    |dir|
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11422
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11423
    dir := self getEnvironment:'USERPROFILE'.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11424
    dir isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11425
	dir := '.'.
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11426
    ].
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 11427
    ^ dir.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11428
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11429
    "
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
 11430
     OperatingSystem getHomeDirectory
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11431
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11432
5264
9a90c499e329 return the currentDir as default fallBack for the getHomeDir query.
Claus Gittinger <cg@exept.de>
parents: 5147
diff changeset
 11433
    "Modified: / 16.2.2000 / 09:17:55 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11434
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11435
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11436
getLoginName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11437
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11438
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11439
    "return a string with the users login name (thats yours)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11440
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11441
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11442
    static char cachedName[64];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11443
    static firstCall = 1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11444
#ifndef __BORLANDC__
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11445
    extern char *getenv();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11446
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11447
    char *name = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11448
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11449
    if (firstCall) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11450
	DWORD nameSize = sizeof(cachedName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11451
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11452
	if (GetUserName(cachedName, &nameSize) == TRUE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11453
	    name = cachedName;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11454
	    firstCall = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11455
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11456
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11457
	name = cachedName;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11458
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11459
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11460
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11461
     * try a few common environment variables ...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11462
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11463
    if (! name || (name[0] == 0) ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11464
	name = getenv("LOGIN");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11465
	if (! name || (name[0] == 0) ) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11466
	    name = getenv("LOGNAME");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11467
	    if (! name || (name[0] == 0) ) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11468
		name = getenv("USER");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11469
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11470
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11471
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11472
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11473
     * nope - I really font know who you are.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11474
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11475
    if (! name || (name[0] == 0) ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11476
	name = "you";
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11477
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11478
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11479
    RETURN ( __MKSTRING(name) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11480
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11481
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11482
     OperatingSystem getLoginName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11483
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11484
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11485
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11486
getUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11487
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11488
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11489
    "return the current users (thats you) numeric user id"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11490
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11491
    ^ 1 "just a dummy for systems which do not have userIDs"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11492
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11493
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11494
     OperatingSystem getUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11495
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11496
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11497
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11498
getUserNameFromID:aNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11499
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11500
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11501
    "return the user-name-string for a given numeric user-id.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11502
     This is the login name, not the fullName."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11503
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11504
    aNumber == self getUserID ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11505
	^ self getLoginName
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11506
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11507
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11508
    ^ '? (' , aNumber printString , ')'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11509
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11510
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11511
     OperatingSystem getUserNameFromID:0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11512
     OperatingSystem getUserNameFromID:100
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 11513
     OperatingSystem getUserNameFromID:9991
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11514
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11515
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11516
15874
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11517
isRunningWithElevatedRootOrAdminRights
15873
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11518
    "return true, if a NORMAL user is running with elevated admin rights."
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11519
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11520
%{
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11521
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11522
    HANDLE h_Process;
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11523
    HANDLE h_Token;
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11524
    TOKEN_ELEVATION t_TokenElevation;
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11525
    TOKEN_ELEVATION_TYPE e_ElevationType;
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11526
    DWORD dw_TokenLength;
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11527
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11528
    h_Process = GetCurrentProcess();
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11529
    if (OpenProcessToken(h_Process,TOKEN_READ,&h_Token) == FALSE) {
15877
a752f474d7a2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15874
diff changeset
 11530
	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
 11531
	goto getOutOfHere;
15873
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11532
    }
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11533
    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
 11534
	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
 11535
	CloseHandle(h_Token);
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11536
	goto getOutOfHere;
15873
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11537
    }
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11538
    if (t_TokenElevation.TokenIsElevated != 0) {
15874
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11539
	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
 11540
	    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
 11541
	    CloseHandle(h_Token);
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11542
	    goto getOutOfHere;
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11543
	} else {
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11544
	    if (e_ElevationType == TokenElevationTypeFull || e_ElevationType == TokenElevationTypeDefault) {
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11545
		CloseHandle(h_Token);
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11546
		RETURN(true);
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11547
	    }
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11548
	    CloseHandle(h_Token);
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11549
	    RETURN(false);
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11550
	}
15873
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11551
    } else {
15874
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11552
	CloseHandle(h_Token);
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 11553
	RETURN(false);
15873
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11554
    }
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11555
getOutOfHere: ;
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11556
%}.
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11557
    "/ self primitiveFailed.
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11558
    ^ false
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11559
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11560
    "Modified: / 17-12-2013 / 17:12:23 / cg"
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11561
!
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 11562
15833
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11563
isRunningWithRootOrAdminRights
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11564
    "read some registry entry which only Admin can read;
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11565
     if we can, we are; otherwise, we are not."
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11566
15834
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11567
%{
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11568
    SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11569
    PSID AdministratorsGroup;
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11570
    BOOL IsInAdminGroup = FALSE;
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11571
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11572
    // Initialize SID.
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11573
    if( !AllocateAndInitializeSid( &NtAuthority,
15870
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11574
				   2,
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11575
				   SECURITY_BUILTIN_DOMAIN_RID,
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11576
				   DOMAIN_ALIAS_RID_ADMINS,
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11577
				   0, 0, 0, 0, 0, 0,
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11578
				   &AdministratorsGroup))
15834
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11579
    {
15870
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11580
	// Initializing SID Failed.
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11581
	RETURN( false );
15834
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11582
    }
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11583
    // Check whether the token is present in admin group.
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11584
    if( !CheckTokenMembership( NULL,
15870
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11585
			       AdministratorsGroup,
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11586
			       &IsInAdminGroup ))
15834
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11587
    {
15870
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11588
	// Error occurred.
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11589
	IsInAdminGroup = FALSE;
15834
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11590
    }
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11591
    // Free SID and return.
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11592
    FreeSid(AdministratorsGroup);
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11593
    RETURN( IsInAdminGroup ? true : false);
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11594
%}.
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11595
    "/ seems not to work...
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 11596
15870
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11597
"/    "/ RegOpenKey(HKEY_USERS, "S-1-5-19", &key)
15835
266f6ab9cdb2 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15834
diff changeset
 11598
"/    (RegistryEntry key:'HKEY_USERS') notNil ifTrue:[
266f6ab9cdb2 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15834
diff changeset
 11599
"/        (RegistryEntry key:'HKEY_USERS/S-1-5-19') notNil ifTrue:[
266f6ab9cdb2 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15834
diff changeset
 11600
"/            ^ true
266f6ab9cdb2 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15834
diff changeset
 11601
"/        ]
266f6ab9cdb2 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15834
diff changeset
 11602
"/    ].
15833
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11603
    ^ false.
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11604
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11605
    "
15870
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 11606
     OperatingSystem isRunningWithRootOrAdminRights
15833
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11607
    "
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11608
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11609
    "Created: / 28-11-2013 / 14:00:02 / cg"
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11610
!
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 11611
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11612
userInfoOf:aNameOrID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11613
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11614
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11615
    "return a dictionary filled with userinfo. The argument can be either
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11616
     a string with the users name or its numeric id.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11617
     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
 11618
     Portable applications may want to check the systemType and NOT depend
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11619
     on all keys to be present in the returned dictionary."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11620
20246
dacb56e06db1 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 20245
diff changeset
 11621
    |info userName loginName "uid gid"|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11622
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11623
    info := IdentityDictionary new.
20246
dacb56e06db1 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 20245
diff changeset
 11624
    loginName := self getLoginName.
dacb56e06db1 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 20245
diff changeset
 11625
    (aNameOrID == self getUserID or:[aNameOrID = loginName]) ifTrue:[
dacb56e06db1 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 20245
diff changeset
 11626
        userName := loginName.
dacb56e06db1 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 20245
diff changeset
 11627
        info at:#dir put:self getHomeDirectory.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11628
    ] ifFalse:[
20246
dacb56e06db1 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 20245
diff changeset
 11629
        userName := 'unknown'.
dacb56e06db1 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 20245
diff changeset
 11630
    ].
dacb56e06db1 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 20245
diff changeset
 11631
    info at:#name put:userName.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11632
    "/ uid notNil ifTrue:[info at:#uid put:uid].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11633
    "/ gid  notNil ifTrue:[info at:#gid put:gid].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11634
    ^ info
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11635
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11636
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11637
     OperatingSystem userInfoOf:'root'
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 11638
     OperatingSystem userInfoOf:1
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 11639
     OperatingSystem userInfoOf:'fooBar'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11640
     OperatingSystem userInfoOf:(OperatingSystem getUserID)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11641
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11642
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11643
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11644
!Win32OperatingSystem class methodsFor:'waiting for events'!
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
blockingChildProcessWait
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11647
     "return true, if childProcessWait: blocks, if no children are ready.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11648
      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
 11649
      a subprocesses status (to avoid blocking)."
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
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11652
!
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
childProcessWait:blocking pid:pidToWait
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11655
    "{ Pragma: +optSpace }"
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
    "get status changes from child processes.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11658
     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
 11659
     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
 11660
     otherwise we return immediately.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 11661
     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
 11662
     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
 11663
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11664
    |pid status code core|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11665
%{
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 11666
//#define PROCESSDEBUG_CHILDPROCESSWAIT
16331
e0db6eac2c1e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16321
diff changeset
 11667
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 11668
    int endStatus;
16331
e0db6eac2c1e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16321
diff changeset
 11669
    DWORD exitCode;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11670
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
 11671
    if (__isExternalAddressLike(pidToWait) ) {
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11672
	HANDLE __pidToWait = _HANDLEVal(pidToWait);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11673
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
 11674
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11675
	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
 11676
#endif
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11677
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11678
	if (blocking == true) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11679
#ifdef DO_WRAP_CALLS
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11680
	    do {
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11681
		__threadErrno = 0;
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11682
		// 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
 11683
		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
 11684
	    } while ((endStatus < 0) && (__threadErrno == EINTR));
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11685
#else
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11686
	    endStatus = WaitForSingleObject(__pidToWait, INFINITE);
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11687
	    if (endStatus < 0) {
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11688
		__threadErrno = __WIN32_ERR(GetLastError());
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11689
	    }
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11690
#endif
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11691
	    if (endStatus == WAIT_TIMEOUT) {
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11692
		if (blocking==true)
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11693
		    status = @symbol(timeout);
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11694
		else {
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11695
		    status = @symbol(continue);
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
 11696
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11697
		    console_printf("ret nil\n");
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11698
#endif
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11699
		    RETURN(nil);
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11700
		}
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11701
	    } else if (endStatus == WAIT_OBJECT_0) {
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11702
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11703
	    }
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11704
	}
16331
e0db6eac2c1e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16321
diff changeset
 11705
12625
6b04dbbeb379 changed: #childProcessWait:pid:
Claus Gittinger <cg@exept.de>
parents: 12616
diff changeset
 11706
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11707
	console_printf("GetExitCodeProcess\n");
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11708
#endif
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11709
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11710
	if (GetExitCodeProcess(__pidToWait, &exitCode)) {
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11711
	    if (exitCode == STILL_ACTIVE) {
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
 11712
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11713
		console_printf("exitCode: STILL_ACTIVE\n");
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11714
#endif
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11715
		RETURN(nil);
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11716
	    }
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
 11717
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11718
	    console_printf("exitCode %d\n", exitCode);
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11719
#endif
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11720
	    status = @symbol(exit);
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11721
	    code = __mkSmallInteger(exitCode);
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11722
	    core = false;
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11723
	    pid = pidToWait;
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11724
	} else {
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11725
	    code = __mkSmallInteger(GetLastError());
16331
e0db6eac2c1e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16321
diff changeset
 11726
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11727
	    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
 11728
#endif
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11729
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11730
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11731
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11732
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11733
    (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
 11734
	^ self primitiveFailed:code
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11735
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11736
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11737
"/ Transcript show:'pid: '; show:pid; show:' status: '; show:status;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11738
"/ show:' code: '; show:code; show:' core:'; showCR:core.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11739
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11740
    ^ OSProcessStatus pid:pid status:status code:code core:core
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11741
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11742
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11743
numAvailableForReadOn:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11744
    "return the number of bytes available for reading, without blocking."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11745
20174
d3f07efc7045 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20063
diff changeset
 11746
%{
d3f07efc7045 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20063
diff changeset
 11747
    unsigned long bytes_available;
d3f07efc7045 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20063
diff changeset
 11748
d3f07efc7045 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20063
diff changeset
 11749
    if (__Class(fd) == @global(Win32SocketHandle)) {
d3f07efc7045 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20063
diff changeset
 11750
        if (ioctlsocket((SOCKET)_HANDLEVal(fd), FIONREAD, &bytes_available) == 0) {
d3f07efc7045 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20063
diff changeset
 11751
            if (bytes_available > _MAX_INT) bytes_available = _MAX_INT;
d3f07efc7045 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20063
diff changeset
 11752
            RETURN(__mkSmallInteger(bytes_available));
d3f07efc7045 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20063
diff changeset
 11753
        }
d3f07efc7045 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20063
diff changeset
 11754
    } else if (__isSmallInteger(fd)) {
d3f07efc7045 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20063
diff changeset
 11755
        if (PeekNamedPipe(_get_osfhandle(__intVal(fd)), NULL, 0, NULL, &bytes_available, NULL) != 0){
d3f07efc7045 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20063
diff changeset
 11756
            if (bytes_available > _MAX_INT) bytes_available = _MAX_INT;
d3f07efc7045 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20063
diff changeset
 11757
            RETURN(__mkSmallInteger(bytes_available));
d3f07efc7045 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20063
diff changeset
 11758
        }
d3f07efc7045 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20063
diff changeset
 11759
    }
d3f07efc7045 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20063
diff changeset
 11760
%}.
d3f07efc7045 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20063
diff changeset
 11761
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11762
    ^ (self readCheck:fd) ifTrue:[1] ifFalse:[0]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11763
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11764
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11765
selectOnAnyReadable:readFdArray writable:writeFdArray exception:exceptFdArray
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11766
  readableInto:readableResultFdArray writableInto:writableResultFdArray exceptionInto:exceptionResultFdArray
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11767
  withTimeOut:millis
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11768
    "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
 11769
     writeFdArray to become ready for writing,
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11770
     or exceptFdArray to arrive exceptional data (i.e. out-of-band data).
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11771
     Timeout after t milliseconds or - if the timeout time is 0 - immediately..
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11772
     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
 11773
     descriptors (i.e. to check if I/O possible without blocking).
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11774
     The corresponding filedescriptors which are ready are returned in readableResultFdArray,
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11775
     writableResultFdArray and exceptionResultFdArray respectively.
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11776
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11777
     Return the (overall) number of selected filedescriptors.
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11778
     readableResultFdArray, writableResultFdArray and exceptionResultFdArray will
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11779
     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
 11780
     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
 11781
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11782
%{
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11783
//#define SELECTDEBUGWIN32
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11784
//#define SELECT3DEBUGWIN32
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11785
#define MAXHANDLE 128
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 11786
    int i, idx;
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11787
    INT t;
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11788
    int numHandles;
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11789
    DWORD res;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11790
    HANDLE hArray[MAXHANDLE+1];
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11791
    int retArray[MAXHANDLE];
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11792
    int readCount, writeCount, exceptCount;
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11793
    int resultSizeReadable = 0, resultSizeWritable = 0, resultSizeException = 0;
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11794
    int cntR = 0, cntW = 0, cntE = 0, cntAll = 0;
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11795
    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
 11796
    fd_set readFds;
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11797
    fd_set writeFds;
18954
813f1c2c49ca #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18951
diff changeset
 11798
    fd_set exceptFds;
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11799
    int hasSockets;
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11800
    int hasPipes;
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11801
    int pass = 1;       // perform up to 2 passes
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11802
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11803
    if (readableResultFdArray != nil) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11804
	if (! __isArrayLike(readableResultFdArray)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11805
	    goto fail;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11806
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11807
	resultSizeReadable = __arraySize(readableResultFdArray);
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11808
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11809
    if (writableResultFdArray != nil) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11810
	if (! __isArrayLike(writableResultFdArray)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11811
	    goto fail;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11812
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11813
	resultSizeWritable = __arraySize(writableResultFdArray);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11814
	if (readableResultFdArray == writableResultFdArray) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11815
	    // allow common result set for read/write/except
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11816
	    pcntW = &cntR;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11817
	}
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11818
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11819
    if (exceptionResultFdArray != nil) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11820
	if (! __isArrayLike(exceptionResultFdArray)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11821
	    goto fail;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11822
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11823
	resultSizeException = __arraySize(exceptionResultFdArray);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11824
	if (exceptionResultFdArray == readableResultFdArray) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11825
	    // allow common result set for read/write/except
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11826
	    pcntE = &cntR;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11827
	} else if (exceptionResultFdArray == writableResultFdArray) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11828
	    pcntE = &cntW;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11829
	}
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11830
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11831
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11832
    if (__isNonNilObject(readFdArray)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11833
	if (! __isArrayLike(readFdArray)) goto fail;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11834
	readCount = __arraySize(readFdArray);
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11835
    } else {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11836
	readCount = 0;
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11837
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11838
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11839
    if (__isNonNilObject(writeFdArray)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11840
	if (! __isArrayLike(writeFdArray)) goto fail;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11841
	writeCount = __arraySize(writeFdArray);
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11842
    } else {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11843
	writeCount = 0;
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11844
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11845
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11846
    if (__isNonNilObject(exceptFdArray)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11847
	if (! __isArrayLike(exceptFdArray)) goto fail;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11848
	exceptCount = __arraySize(exceptFdArray);
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11849
    } else {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11850
	exceptCount = 0;
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11851
    }
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11852
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11853
pollAgain:
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11854
    FD_ZERO(&readFds);
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11855
    FD_ZERO(&writeFds);
18954
813f1c2c49ca #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18951
diff changeset
 11856
    FD_ZERO(&exceptFds);
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11857
    numHandles = hasSockets = hasPipes = 0;
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11858
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11859
    for (i = 0; (i < readCount) && (numHandles < MAXHANDLE); i++) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11860
	OBJ fd = __arrayVal(readFdArray)[i];
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
	if (fd != nil) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11863
	    if (__Class(fd) == @global(Win32SocketHandle)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11864
		FD_SET (_HANDLEVal(fd), &readFds);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11865
		hasSockets++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11866
	    } else if (__isSmallInteger(fd)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11867
		DWORD canRead;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11868
		if (PeekNamedPipe(_get_osfhandle(__intVal(fd)), 0, 0, 0, &canRead, 0)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11869
		    if (canRead > 0) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11870
			if (*pcntR < resultSizeReadable) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11871
			    __arrayVal(readableResultFdArray)[*pcntR] = fd;
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
			(*pcntR)++; cntAll++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11874
		    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11875
		} else {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11876
		    @global(LastErrorNumber) = __mkSmallInteger(EBADF);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11877
		    RETURN (__mkSmallInteger(-1));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11878
		}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11879
		hasPipes++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11880
	    } else {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11881
		hArray  [numHandles] = _HANDLEVal(fd);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11882
		retArray[numHandles] = i;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11883
		++numHandles;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11884
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11885
	}
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11886
    }
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11887
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11888
    for (i = 0; (i < writeCount) && (numHandles < MAXHANDLE); i++) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11889
	OBJ fd = __arrayVal(writeFdArray)[i];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11890
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11891
	if (fd != nil) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11892
	    if (__Class(fd) == @global(Win32SocketHandle)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11893
		FD_SET (_HANDLEVal(fd), &writeFds);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11894
		hasSockets++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11895
	    } else if (__isSmallInteger(fd)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11896
		// kludge: assume that pipes can alway be written
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11897
	       if (*pcntW < resultSizeWritable) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11898
		    __arrayVal(writableResultFdArray)[*pcntW] = fd;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11899
		}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11900
		(*pcntW)++; cntAll++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11901
		// there is no pipe to check
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11902
	    } else {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11903
		hArray  [numHandles] = _HANDLEVal(fd);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11904
		retArray[numHandles] = i + 10000;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11905
		++numHandles;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11906
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11907
	}
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11908
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11909
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11910
    for (i = 0; (i < exceptCount) && (numHandles < MAXHANDLE); i++) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11911
	OBJ fdOrPid = __arrayVal(exceptFdArray)[i];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11912
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11913
	if (fdOrPid != nil) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11914
	    if (__Class(fdOrPid) == @global(Win32SocketHandle)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11915
		FD_SET (_HANDLEVal(fdOrPid), &exceptFds);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11916
		hasSockets++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11917
	    } else if (__isExternalAddressLike(fdOrPid)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11918
		// a PID
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11919
		hArray  [numHandles] = _HANDLEVal(fdOrPid);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11920
		retArray[numHandles] = i + 20000;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11921
		++numHandles;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11922
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11923
	}
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11924
    }
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11925
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11926
    if (hasSockets) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11927
	struct timeval tv = {0, 0};
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11928
	int nReady;
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11929
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11930
#ifdef SELECT3DEBUGWIN32
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11931
	console_printf("select hasSockets = %d\n", hasSockets);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11932
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11933
	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
 11934
	if (nReady < 0) {
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11935
#ifdef SELECTDEBUGWIN32
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11936
	    console_printf("error in select %d %d\n", nReady, GetLastError());
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11937
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11938
	    @global(LastErrorNumber) = __mkSmallInteger(EBADF);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11939
	    RETURN (__mkSmallInteger(-1));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11940
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11941
	if (nReady > 0) {
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11942
#ifdef SELECT3DEBUGWIN32
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11943
	    console_printf("select nReady %d of %d\n", nReady, hasSockets);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11944
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11945
	    for (i = 0; i < readCount; i++) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11946
		OBJ fd = __arrayVal(readFdArray)[i];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11947
		if ((__Class(fd) == @global(Win32SocketHandle)) && FD_ISSET(_HANDLEVal(fd), &readFds)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11948
		    if (*pcntR < resultSizeReadable) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11949
			__arrayVal(readableResultFdArray)[*pcntR] = fd;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11950
			__STORE(readableResultFdArray, fd);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11951
		    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11952
		    (*pcntR)++; cntAll++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11953
		}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11954
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11955
	    for (i = 0; i < writeCount; i++) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11956
		OBJ fd = __arrayVal(writeFdArray)[i];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11957
		if ((__Class(fd) == @global(Win32SocketHandle)) && FD_ISSET(_HANDLEVal(fd), &writeFds)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11958
		    if (*pcntW < resultSizeWritable) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11959
			__arrayVal(writableResultFdArray)[*pcntW] = fd;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11960
			__STORE(writableResultFdArray, fd);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11961
		    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11962
		    (*pcntW)++; cntAll++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11963
		}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11964
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11965
	    for (i = 0; i < exceptCount; i++) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11966
		OBJ fd = __arrayVal(exceptFdArray)[i];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11967
		if ((__Class(fd) == @global(Win32SocketHandle)) && FD_ISSET(_HANDLEVal(fd), &exceptFds)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11968
		    if (*pcntE < resultSizeException) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11969
			__arrayVal(exceptionResultFdArray)[*pcntE] = fd;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11970
			__STORE(exceptionResultFdArray, fd);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11971
		    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11972
		    (*pcntE)++; cntAll++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11973
		}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11974
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11975
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11976
	}
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11977
    }
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 11978
    if (pass > 1)       // perform maximum 2 passes
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11979
	goto done;
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11980
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11981
    if (cntAll) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11982
	// check for other handles and return immediately, no timeout
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11983
	t = 0;
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11984
    } else {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11985
	if (__isSmallInteger(millis)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11986
	    t = __intVal(millis);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11987
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11988
	    if (t <= 0 && numHandles == 0) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11989
		RETURN (__mkSmallInteger(0));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11990
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11991
	} else {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11992
	    t = INFINITE;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11993
	}
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
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11996
    if (numHandles == 0 && t == 0) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11997
	// nothing to do and no wait
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 11998
	goto done;
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 11999
    }
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 12000
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 12001
#ifdef SELECT3DEBUGWIN32
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 12002
    console_printf("wait numhandles = %d timeout = %d\n", numHandles, t);
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 12003
#endif
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 12004
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 12005
    res = __vmWait(numHandles, hArray, MAXHANDLE, t);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 12006
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 12007
    if (res == WAIT_TIMEOUT) {
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 12008
#ifdef SELECT3DEBUGWIN32
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12009
	console_printf("- timeOut; ret nil\n" );
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12010
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12011
	if (t != 0 && (hasSockets || hasPipes)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12012
	    // if not a single handle is ready, poll sockets an pipes again
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12013
	    pass = 2;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12014
	    goto pollAgain;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12015
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12016
	goto done;
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 12017
    }
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 12018
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 12019
    if (res == WAIT_FAILED) {
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 12020
#ifdef SELECT2DEBUGWIN32
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12021
	console_printf("- error %d (last %d); ret -1\n", __threadErrno, GetLastError());
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12022
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12023
	if (__threadErrno == EINTR) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12024
	    @global(LastErrorNumber) = nil;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12025
	    RETURN (__mkSmallInteger(0));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12026
	} else {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12027
	    if (@global(InfoPrinting) == true) {
16331
e0db6eac2c1e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16321
diff changeset
 12028
//                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
 12029
		console_printf("Win32OS [info]: select errno = %d (last %d)\n", __threadErrno, GetLastError());
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12030
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12031
	    @global(LastErrorNumber) = __mkSmallInteger(EBADF);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12032
	    RETURN (__mkSmallInteger(-1));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12033
	}
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 12034
    }
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 12035
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 12036
    if (numHandles) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12037
	if (res == numHandles) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12038
	    // 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
 12039
	    if (1 /* @global(InfoPrinting) == true */) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12040
		console_fprintf(stderr, "Win32OS [info]: plugIn event has been handled\n");
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12041
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12042
	    goto done;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12043
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12044
	if ((res < 0) || (res >= numHandles)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12045
	    console_printf("- res=%d error1 %d\n", res, GetLastError());
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12046
	    goto done;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12047
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12048
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12049
	idx = retArray[res];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12050
	cntAll++;
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12051
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 12052
#ifdef SELECTDEBUGWIN32
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12053
	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
 12054
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12055
	if (idx < 10000) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12056
	    if (*pcntR < resultSizeReadable) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12057
		OBJ temp = __arrayVal(readFdArray)[idx];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12058
		__arrayVal(readableResultFdArray)[*pcntR] = temp;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12059
		__STORE(readableResultFdArray, temp);
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 12060
#ifdef SELECTDEBUGWIN32
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12061
		console_printf("read ready: %x\n", __externalAddressVal(temp));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12062
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12063
		(*pcntR)++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12064
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12065
	} else if (idx < 20000) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12066
	    if (*pcntW < resultSizeWritable) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12067
		OBJ temp = __arrayVal(writeFdArray)[idx-10000];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12068
		__arrayVal(writableResultFdArray)[*pcntW] = temp;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12069
		__STORE(writableResultFdArray, temp);
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12070
#ifdef SELECTDEBUGWIN32
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12071
		console_printf("write ready: %x\n", temp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12072
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12073
		(*pcntW)++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12074
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12075
	} else {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12076
	    if (*pcntE < resultSizeException) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12077
		OBJ temp = __arrayVal(exceptFdArray)[idx-20000];
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12078
		__arrayVal(exceptionResultFdArray)[*pcntE] = temp;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12079
		__STORE(exceptionResultFdArray, temp);
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 12080
#ifdef SELECTDEBUGWIN32
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12081
		console_printf("except ready: %x\n", temp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12082
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12083
		(*pcntE)++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12084
	    }
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 12085
#ifdef SELECTDEBUGWIN32
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12086
	    else
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12087
		console_printf("cntE: %d, resultSizeException: %d\n", *pcntE, resultSizeException);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12088
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12089
	}
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 12090
    }
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 12091
    if (t != 0 && (hasSockets || hasPipes)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12092
	// back after timeout, maybe some sockets or pipes did wake up
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12093
	// in the meantime?
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12094
	pass = 2;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12095
	goto pollAgain;
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 12096
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 12097
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 12098
done:
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 12099
    /* add a delimiter */
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 12100
    if (*pcntR < resultSizeReadable) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12101
	__arrayVal(readableResultFdArray)[*pcntR] = nil;
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 12102
    }
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 12103
    if (*pcntW < resultSizeWritable) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12104
	__arrayVal(writableResultFdArray)[*pcntW] = nil;
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 12105
    }
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 12106
    if (*pcntE < resultSizeException) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12107
	__arrayVal(exceptionResultFdArray)[*pcntE] = nil;
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 12108
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 12109
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 12110
    @global(LastErrorNumber) = nil;
16315
b08c60b1588d class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16309
diff changeset
 12111
    RETURN (__mkSmallInteger(cntAll));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12112
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12113
fail: ;
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
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12116
     timeout argument not integer,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12117
     or any fd-array nonNil and not an array
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12118
     or not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12119
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12120
    ^ self primitiveFailed
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
setBlocking:aBoolean on:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12124
    "set/clear the blocking attribute - if set (which is the default)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12125
     a read on the fileDescriptor will block until data is available.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12126
     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
 12127
     nil.
6bc82606b914 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15877
diff changeset
 12128
6bc82606b914 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15877
diff changeset
 12129
     Ignored in windows. Windows calls operate in their own thread,
6bc82606b914 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15877
diff changeset
 12130
     so non-blocking mode doesn't make sense."
6bc82606b914 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15877
diff changeset
 12131
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12132
    ^ true
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12133
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12134
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12135
waitForMultipleObjects:fdOrHandleArray withTimeout:millis
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12136
    "wait for an fd to become ready.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12137
     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
 12138
     Zero time can be used to poll a file-
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12139
     descriptors (i.e. to check if I/O possible without blocking).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12140
     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
 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
#ifndef MAXHANDLE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12144
# define MAXHANDLE 128
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12145
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12146
    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
 12147
    int res;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12148
    HANDLE hArray[MAXHANDLE];
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12149
    int idxArray[MAXHANDLE];
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12150
    INT i, count, hIdx;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12151
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8912
diff changeset
 12152
    if (! __isArrayLike(fdOrHandleArray)) {
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12153
	goto fail;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12154
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12155
    count = __arraySize(fdOrHandleArray);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12156
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12157
    for (hIdx=0, i=0; i<count; i++) {
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12158
	OBJ fdOrHandle = __ArrayInstPtr(fdOrHandleArray)->a_element[i];
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12159
	HANDLE h;
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12160
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12161
	if (fdOrHandle != nil) {
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12162
	    if (__isExternalAddressLike(fdOrHandle)) {
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12163
		h = _HANDLEVal(fdOrHandle);
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12164
	    } else {
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12165
		if (__isSmallInteger(fdOrHandle)) {
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12166
		    h = (HANDLE) _get_osfhandle (__intVal(fdOrHandle));
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12167
		} else {
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12168
		    goto fail;
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12169
		}
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12170
	    }
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12171
	    hArray[hIdx] = h;
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12172
	    idxArray[hIdx++] = i;
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12173
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12174
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12175
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12176
    if (__isSmallInteger(millis)) {
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12177
	t = __intVal(millis);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12178
    } else {
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12179
	t = INFINITE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12180
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12181
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12182
#ifdef DO_WRAP_CALLS
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12183
    if (t != 0) {
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12184
	do {
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12185
	    __threadErrno = 0;
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12186
	    // do not cast to INT - will loose sign bit then!
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12187
	    res = STX_API_CALL4( "WaitForMultipleObjects", WaitForMultipleObjects, hIdx, hArray, FALSE, t);
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12188
	} while ((res < 0) && (__threadErrno == EINTR));
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12189
    } else
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12190
#endif
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12191
    {
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12192
	res = WaitForMultipleObjects(hIdx, hArray, FALSE, t);
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12193
	if (res < 0) {
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12194
	    __threadErrno = __WIN32_ERR(GetLastError());
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12195
	}
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12196
    }
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12197
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12198
    if (res == WAIT_FAILED) {
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12199
	RETURN (nil);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12200
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12201
    if (res == WAIT_TIMEOUT) {
16337
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12202
	RETURN (nil);
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12203
    }
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12204
    if ((res >= WAIT_OBJECT_0) && (res < (WAIT_OBJECT_0+hIdx))) {
40052517e9b6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16334
diff changeset
 12205
	RETURN (__arrayVal(fdOrHandleArray)[idxArray[res-WAIT_OBJECT_0]]);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12206
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12207
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12208
    RETURN (nil);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12209
fail: ;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12210
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12211
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12212
     invalid arg,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12213
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12214
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12215
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12216
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12217
waitForSingleObject:fdOrHandle withTimeout:millis
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12218
    "wait for an fd to become ready.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12219
     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
 12220
     Zero time can be used to poll a file-
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12221
     descriptors (i.e. to check if I/O possible without blocking).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12222
     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
 12223
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12224
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12225
    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
 12226
    int res;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12227
    HANDLE h = NULL;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12228
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
 12229
    if (__isExternalAddressLike(fdOrHandle)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12230
	h = _HANDLEVal(fdOrHandle);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12231
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12232
	if (__isSmallInteger(fdOrHandle)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12233
	    h = (HANDLE) _get_osfhandle (__intVal(fdOrHandle));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12234
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12235
	    goto fail;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12236
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12237
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12238
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12239
    if (__isSmallInteger(millis)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12240
	t = __intVal(millis);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12241
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12242
	t = INFINITE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12243
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12244
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12245
#ifdef DO_WRAP_CALLS
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 12246
    do {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12247
	__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
 12248
	// do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12249
	res = STX_API_CALL2( "WaitForSingleObject", WaitForSingleObject, h,  t);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12250
    } while ((res < 0) && (__threadErrno == EINTR));
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12251
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12252
    res = WaitForSingleObject(h, t);
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
 12253
    if (res < 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12254
	__threadErrno = __WIN32_ERR(GetLastError());
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
 12255
    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12256
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12257
    if (res == WAIT_FAILED) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12258
	RETURN (nil);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12259
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12260
    if (res == WAIT_TIMEOUT) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12261
	RETURN (nil);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12262
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12263
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12264
    RETURN (fdOrHandle);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12265
fail: ;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12266
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12267
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12268
     invalid arg,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12269
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12270
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12271
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 12272
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12273
!Win32OperatingSystem::DevModeStructure methodsFor:'accessing'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12274
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12275
bitsPerPel
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12276
    ^ self unsignedLongAt: 1+104
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12277
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12278
    "Created: / 27-07-2006 / 15:14:17 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12279
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12280
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12281
collate
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12282
    ^ self signedInt16At: 1+68 MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12283
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12284
    "Created: / 01-08-2006 / 09:56:38 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12285
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12286
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12287
collate: n
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12288
    ^ self signedInt16At: 1+68 put: n MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12289
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12290
    "Created: / 01-08-2006 / 09:58:07 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12291
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12292
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12293
color
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12294
    ^ self signedInt16At: 1+60 MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12295
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12296
    "Created: / 27-07-2006 / 15:31:25 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12297
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12298
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12299
copies
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12300
    ^ self signedInt16At: 1+54 MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12301
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12302
    "Created: / 27-07-2006 / 15:30:52 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12303
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12304
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12305
copies: n
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12306
    ^ self signedInt16At: 1+54 put: n MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12307
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12308
    "Created: / 27-07-2006 / 15:36:39 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12309
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12310
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12311
deviceName
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12312
    ^ self stringAt: 1+0 size: 32
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12313
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12314
    "Created: / 27-07-2006 / 15:15:52 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12315
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12316
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12317
orientation
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12318
    ^ self signedInt16At: 1+44 MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12319
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12320
    "Created: / 27-07-2006 / 15:34:57 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12321
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12322
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12323
orientation: orientationInt
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12324
    ^ self signedInt16At: 1+44 put: orientationInt MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12325
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12326
    "Created: / 27-07-2006 / 15:36:31 / 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
paperLength
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12330
    ^ self signedInt16At: 1+48 MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12331
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12332
    "Created: / 27-07-2006 / 15:32:59 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12333
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12334
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12335
paperSize
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12336
    ^ self signedInt16At: 1+46 MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12337
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12338
    "Created: / 27-07-2006 / 15:32:12 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12339
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12340
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12341
paperSize:funnyMSPaperSizeCode
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12342
    ^ self signedInt16At: 1+46 put: funnyMSPaperSizeCode MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12343
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12344
    "Created: / 27-07-2006 / 15:35:53 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12345
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12346
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12347
paperWidth
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12348
    ^ self signedInt16At: 1+50 MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12349
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12350
    "Created: / 27-07-2006 / 15:32:25 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12351
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12352
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12353
printQuality
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12354
    ^ self signedInt16At: 1+58 MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12355
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12356
    "Created: / 27-07-2006 / 15:33:58 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12357
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12358
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12359
printQuality: qualityInteger
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12360
    ^ self signedInt16At: 1+58 put: qualityInteger MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12361
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12362
    "Created: / 27-07-2006 / 15:36:20 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12363
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12364
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12365
scale
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12366
    ^ self signedInt16At: 1+52 MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12367
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12368
    "Created: / 27-07-2006 / 15:33:31 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12369
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12370
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12371
scale: percent
19369
ccf33c1cd9d8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19367
diff changeset
 12372
    ^ self signedInt16At: 1+52 put: percent MSB: UninterpretedBytes isBigEndian
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12373
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12374
    "Created: / 27-07-2006 / 15:36:05 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12375
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12376
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12377
!Win32OperatingSystem::DocInfoStructure class methodsFor:'instance creation'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12378
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12379
new
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12380
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12381
^super new: self sizeInBytes
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12382
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12383
    "Created: / 02-08-2006 / 16:21:01 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12384
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12385
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12386
sizeInBytes
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12387
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12388
^20
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12389
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12390
    "Created: / 02-08-2006 / 16:21:10 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12391
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12392
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12393
!Win32OperatingSystem::DocInfoStructure methodsFor:'accessing'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12394
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12395
cbSize
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12396
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12397
^self longAt: 0+1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12398
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12399
    "Created: / 28-07-2006 / 18:36:02 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12400
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12401
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12402
cbSize: aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12403
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12404
self longAt: 0+1 put: aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12405
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12406
    "Created: / 28-07-2006 / 18:37:25 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12407
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12408
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12409
fwType
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12410
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12411
^self longAt: 16+1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12412
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12413
    "Created: / 28-07-2006 / 18:37:44 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12414
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12415
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12416
fwType: aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12417
"Set a DWORD fwType"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12418
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12419
self longAt: 16+1 put:aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12420
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12421
    "Created: / 28-07-2006 / 18:38:17 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12422
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12423
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12424
lpszDocName
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12425
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12426
^(ExternalBytes address:(self unsignedLongAt: 4+1)) stringAt:1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12427
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12428
    "Created: / 03-08-2006 / 15:06:56 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12429
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12430
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12431
lpszDocName: aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12432
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12433
^self unsignedLongAt: 4+1 put: aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12434
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12435
    "Created: / 03-08-2006 / 15:08:32 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12436
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12437
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12438
lpszOutput
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12439
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12440
^(ExternalBytes address:(self unsignedLongAt: 8+1)) stringAt:1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12441
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12442
    "Created: / 03-08-2006 / 15:07:52 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12443
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12444
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12445
lpszOutput: aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12446
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12447
^self unsignedLongAt: 8+1 put: aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12448
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12449
    "Created: / 03-08-2006 / 15:08:49 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12450
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 12451
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12452
!Win32OperatingSystem::FileStatusInfo class methodsFor:'instance creation'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12453
11258
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12454
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
 12455
    ^ self basicNew
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12456
	type:t mode:m uid:u gid:g size:s
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12457
	id:i accessed:aT modified:mT created:cT
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12458
	sourcePath:lP
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12459
	fullName:fullName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12460
	alternativeName:name2
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12461
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12462
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12463
!Win32OperatingSystem::FileStatusInfo methodsFor:'accessing'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12464
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12465
accessTime
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12466
    "return accessed"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12467
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12468
    ^ accessed
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12469
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12470
    "Created: / 1.2.2002 / 11:05:49 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12471
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12472
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12473
alternativeName
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12474
    "return the files other name (DOS name on windows).
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12475
     Nil if there is no other name"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12476
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12477
    |path idx|
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12478
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12479
    path := self alternativePathName.
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12480
    path notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12481
	idx := path lastIndexOf:$\ startingAt:path size-1.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12482
	idx ~~ 0 ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12483
	    path := path copyFrom:(idx+1).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12484
	].
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12485
    ].
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12486
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12487
    ^ path
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12488
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12489
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12490
	'C:\' asFilename info alternativeName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12491
	'C:\Dokumente und Einstellungen\' asFilename info alternativeName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12492
	'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
 12493
    "
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12494
!
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12495
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12496
alternativePathName
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12497
    "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
 12498
     Nil if there is no other name"
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12499
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12500
    "/ access lazily...
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12501
    alternativePathName isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12502
	alternativePathName := (OperatingSystem getShortPathName:sourcePath) asSingleByteString.
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12503
    ].
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12504
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12505
    ^ alternativePathName
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12506
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12507
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12508
	'C:\' asFilename info alternativePathName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12509
	'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
 12510
    "
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12511
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12512
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12513
creationTime
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12514
    ^ created
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12515
!
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12516
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12517
fileSize
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12518
    "return size"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12519
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12520
    ^ size
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12521
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12522
    "Created: / 1.2.2002 / 11:06:15 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12523
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12524
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
 12525
fullName
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
 12526
    "return the files real name (non-DOS name on windows).
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
 12527
     Nil if there is no other name"
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
 12528
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12529
    |path idx|
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12530
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12531
    path := self fullPathName.
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12532
    path notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12533
	idx := path lastIndexOf:$\ startingAt:path size-1.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12534
	idx ~~ 0 ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12535
	    path := path copyFrom:(idx+1).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12536
	].
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12537
    ].
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12538
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12539
    ^ path
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12540
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12541
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12542
	'\' asFilename info fullName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12543
	'C:\' asFilename info fullName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12544
	'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
 12545
    "
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12546
!
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12547
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12548
fullPathName
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12549
    "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
 12550
     Nil if there is no other name"
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12551
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12552
    "/ access lazily...
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12553
    fullPathName isNil ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12554
	fullPathName := OperatingSystem getLongPathName:sourcePath.
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12555
    ].
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12556
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12557
    ^ fullPathName
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12558
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12559
    "
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12560
	'C:\' asFilename info fullPathName
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 12561
	'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
 12562
    "
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
 12563
!
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
 12564
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12565
gid
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12566
    "return gid"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12567
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12568
    ^ gid
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12569
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12570
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12571
id
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12572
    "return id"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12573
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12574
    ^ id
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12575
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12576
11258
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12577
linkTargetPath
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12578
    "for symbolic links only: return the path where the symbolic link points to"
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12579
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12580
    "/ access lazily...
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12581
    linkTargetPath isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12582
	type == #symbolicLink ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12583
	    linkTargetPath := OperatingSystem getLinkTarget:sourcePath.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12584
	]
11258
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12585
    ].
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12586
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12587
    ^ linkTargetPath
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12588
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12589
    "Modified: / 07-02-2007 / 10:31:56 / cg"
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12590
!
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12591
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12592
mode
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12593
    "return mode"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12594
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12595
    ^ mode
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12596
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12597
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12598
modificationTime
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12599
    "return modified"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12600
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12601
    ^ modified
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12602
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12603
    "Created: / 1.2.2002 / 11:06:33 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12604
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12605
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12606
numLinks
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12607
    "DOS has no hardLinks - return 1"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12608
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12609
    ^ 1
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12610
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12611
    "Created: / 1.2.2002 / 11:07:04 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12612
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12613
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12614
path
11258
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12615
    "for symbolic links only: return the path where the symbolic link points to.
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12616
     bad named method - left here for backward compatibility"
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12617
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12618
    ^ self linkTargetPath.
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12619
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12620
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12621
size
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12622
    "return size"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12623
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12624
    ^ size
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12625
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12626
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 12627
sourcePath
a7170033e17f directory access
ca
parents: 17169
diff changeset
 12628
    ^ sourcePath
a7170033e17f directory access
ca
parents: 17169
diff changeset
 12629
!
a7170033e17f directory access
ca
parents: 17169
diff changeset
 12630
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12631
statusChangeTime
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12632
    "return statusChanged"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12633
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12634
    ^ statusChanged ? modified
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12635
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12636
    "Created: / 1.2.2002 / 11:07:27 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12637
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12638
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12639
type
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12640
    "return type"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12641
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12642
    ^ type
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12643
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12644
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12645
uid
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12646
    "return uid"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12647
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12648
    ^ uid
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12649
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12650
10585
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12651
!Win32OperatingSystem::FileStatusInfo methodsFor:'accessing-vms'!
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
fixedHeaderSize
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12654
    "return the fixedHeaderSize (VMS only; nil everywhere else)"
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
    ^ nil
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12657
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12658
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12659
recordAttributes
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12660
    "return the recordAttributes (VMS only; nil everywhere else)"
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12661
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12662
    ^ nil
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
recordFormat
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12666
    "return the recordFormat (VMS only; nil everywhere else)"
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
    ^ nil
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12669
!
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
recordFormatNumeric
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12672
    "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
 12673
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12674
    ^ nil
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
recordSize
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12678
    "return the recordSize (VMS only; nil everywhere else)"
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
    ^ nil
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12681
! !
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12682
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12683
!Win32OperatingSystem::FileStatusInfo methodsFor:'backward compatibility'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12684
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12685
accessed
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12686
    "return accessed"
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12687
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12688
    <resource: #obsolete>
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12689
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12690
    self obsoleteMethodWarning:'use #accessTime'.
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12691
    ^ accessed
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12692
!
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12693
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12694
at:key
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12695
    "backward compatibility access: in previous releases, IdentityDictionaries
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12696
     were used to hold my information. Allow access via key messages.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12697
     This method will vanish - use the proper access protocol."
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12698
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12699
    ^ self perform:key
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12700
!
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12701
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12702
modified
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12703
    <resource: #obsolete>
9061
20af48b9b295 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9026
diff changeset
 12704
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12705
    self obsoleteMethodWarning:'use #modificationTime'.
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12706
    ^ modified
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12707
!
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12708
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12709
statusChanged
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12710
    <resource: #obsolete>
9061
20af48b9b295 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9026
diff changeset
 12711
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12712
    self obsoleteMethodWarning:'use #statusChangeTime'.
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12713
    ^ statusChanged
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12714
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12715
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12716
!Win32OperatingSystem::FileStatusInfo methodsFor:'private accessing'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12717
11258
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12718
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
 12719
    type := t.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12720
    mode := m.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12721
    uid := u.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12722
    gid := g.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12723
    size := s.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12724
    id := i.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12725
    accessed := aT.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12726
    modified := mT.
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12727
    created := cT.
11258
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12728
    sourcePath := lP.
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12729
    fullPathName := name1.
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12730
    alternativePathName := name2.
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12731
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12732
10585
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12733
!Win32OperatingSystem::FileStatusInfo methodsFor:'queries-access'!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12734
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12735
isGroupExecutable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12736
    ^ mode bitTest:8r10
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12737
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12738
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12739
      'smalltalk.rc' asFilename info isGroupExecutable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12740
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12741
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12742
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12743
isGroupReadable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12744
    ^ mode bitTest:8r40
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12745
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12746
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12747
      'smalltalk.rc' asFilename info isGroupReadable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12748
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12749
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12750
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12751
isGroupWritable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12752
    ^ mode bitTest:8r20
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12753
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12754
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12755
      'smalltalk.rc' asFilename info isGroupWritable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12756
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12757
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12758
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12759
isOwnerExecutable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12760
    ^ mode bitTest:8r100
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12761
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12762
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12763
      'smalltalk.rc' asFilename info isOwnerExecutable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12764
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12765
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12766
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12767
isOwnerReadable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12768
    ^ mode bitTest:8r400
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12769
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12770
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12771
      'smalltalk.rc' asFilename info isOwnerReadable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12772
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12773
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12774
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12775
isOwnerWritable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12776
    ^ mode bitTest:8r200
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12777
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12778
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12779
      'smalltalk.rc' asFilename info isOwnerWritable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12780
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12781
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12782
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12783
isWorldExecutable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12784
    ^ mode bitTest:8r1
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12785
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12786
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12787
      'smalltalk.rc' asFilename info isWorldExecutable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12788
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12789
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12790
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12791
isWorldReadable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12792
    ^ mode bitTest:8r4
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12793
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12794
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12795
      'smalltalk.rc' asFilename info isWorldReadable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12796
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12797
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12798
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12799
isWorldWritable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12800
    ^ mode bitTest:8r2
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12801
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12802
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12803
      'smalltalk.rc' asFilename info isWorldWritable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12804
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12805
! !
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12806
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12807
!Win32OperatingSystem::FileStatusInfo methodsFor:'queries-type'!
6799
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12808
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12809
isBlockSpecial
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12810
    ^ type == #characterSpecial
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12811
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12812
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12813
isCharacterSpecial
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12814
    ^ type == #characterSpecial
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12815
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12816
6799
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12817
isDirectory
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12818
    ^ type == #directory
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12819
!
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12820
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12821
isFifo
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12822
    ^ type == #fifo
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12823
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12824
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12825
isRegular
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12826
    ^ type == #regular
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12827
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12828
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12829
isSocket
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12830
    ^ type == #socket
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12831
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12832
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
 12833
isSpecialFile
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
 12834
    ^ (type ~~ #directory
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
 12835
	and:[type ~~ #remoteDirectory
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
 12836
	and:[type ~~ #regular
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
 12837
	and:[type ~~ #symbolicLink
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
 12838
    ]]])
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
 12839
!
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
 12840
6799
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12841
isSymbolicLink
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12842
    ^ 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
 12843
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12844
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12845
isUnknown
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12846
    ^ type == #unknown
17286
a7170033e17f directory access
ca
parents: 17169
diff changeset
 12847
!
a7170033e17f directory access
ca
parents: 17169
diff changeset
 12848
a7170033e17f directory access
ca
parents: 17169
diff changeset
 12849
isValid
a7170033e17f directory access
ca
parents: 17169
diff changeset
 12850
    "answer true if the fileInfo is valid"
a7170033e17f directory access
ca
parents: 17169
diff changeset
 12851
    ^ type notNil
6799
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12852
! !
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12853
9155
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 12854
!Win32OperatingSystem::OSProcessStatus class methodsFor:'documentation'!
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 12855
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12856
documentation
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
    This is an auxillary class, that holds information about status changes of
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12859
    operating system processes (these are no smalltalk processes!!).
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12860
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12861
    [Instance variables:]
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12862
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12863
	pid     <Integer>       OS-Process identifier
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12864
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12865
	status  <Symbol>        either #exit #signal #stop #continue
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12866
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12867
	code    <Integer>       either exitcode or signalnumber
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12868
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12869
	core    <Boolean>       true if core has been dumped
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12870
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12871
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12872
    [author:]
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12873
	Stefan Vogel
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12874
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12875
    [see also:]
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12876
	OperatingSystem
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12877
"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12878
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12879
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12880
!Win32OperatingSystem::OSProcessStatus class methodsFor:'instance creation'!
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
pid:pid status:status code:code core:core
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12883
    "private interface for Win32OperatingSystem"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12884
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12885
    ^ self new pid:pid status:status code:code core:core
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
    "Created: 28.12.1995 / 14:16:14 / stefan"
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12888
    "Modified: 30.4.1996 / 18:25:00 / cg"
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12889
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12890
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12891
processCreationFailure
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12892
    "private interface for Win32OperatingSystem"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12893
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12894
    ^ self new pid:-1 status:#failure code:-1 core:false
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12895
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12896
    "Created: 28.12.1995 / 14:35:29 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12897
    "Modified: 30.4.1996 / 18:25:05 / cg"
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12898
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12899
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12900
!Win32OperatingSystem::OSProcessStatus methodsFor:'accessing'!
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
code
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12903
    "return the exitcode / signalNumber"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12904
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12905
    ^ code
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
    "Created: 28.12.1995 / 14:05:07 / stefan"
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12908
    "Modified: 30.4.1996 / 18:26:23 / cg"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12909
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12910
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12911
core
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12912
    "return true if core has been dumped, false otherwise"
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12913
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12914
    ^ core == true
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12915
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12916
    "Modified: 28.12.1995 / 14:14:38 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12917
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12918
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12919
pid
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12920
    "return the pid"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12921
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12922
    ^ pid
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12923
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12924
    "Created: 28.12.1995 / 14:05:07 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12925
    "Modified: 30.4.1996 / 18:26:30 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12926
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12927
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12928
status
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12929
    "return status as a Symbol;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12930
     one of #exit #signal #stop #continue"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12931
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12932
    ^ status
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12933
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12934
    "Created: 28.12.1995 / 14:05:07 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12935
    "Modified: 30.4.1996 / 18:26:54 / cg"
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12936
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12937
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12938
!Win32OperatingSystem::OSProcessStatus methodsFor:'initialization'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12939
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12940
pid:newPid status:newStatus code:newCode core:newCore
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12941
    pid := newPid.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12942
    status := newStatus.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12943
    code := newCode.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12944
    core := newCore.
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12945
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12946
    "Created: 28.12.1995 / 14:18:22 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12947
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12948
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12949
!Win32OperatingSystem::OSProcessStatus methodsFor:'private-OS interface'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12950
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12951
code:something
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12952
    "set the exitCode"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12953
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12954
    code := something.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12955
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12956
    "Created: 28.12.1995 / 14:05:07 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12957
    "Modified: 30.4.1996 / 18:25:18 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12958
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12959
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12960
core:something
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12961
    "set core"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12962
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12963
    core := something.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12964
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12965
    "Created: 28.12.1995 / 14:05:07 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12966
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12967
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12968
pid:something
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12969
    "set pid"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12970
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12971
    pid := something.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12972
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12973
    "Created: 28.12.1995 / 14:05:07 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12974
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12975
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12976
status:something
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12977
    "set status"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12978
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12979
    status := something.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12980
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12981
    "Created: 28.12.1995 / 14:05:07 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12982
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12983
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12984
!Win32OperatingSystem::OSProcessStatus methodsFor:'queries'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12985
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12986
couldNotExecute
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12987
    "return true when a command could not be executed"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12988
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12989
    ^ status == #exit and:[code = 127].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12990
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12991
    "Created: 28.12.1995 / 15:43:17 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12992
    "Modified: 30.4.1996 / 18:27:03 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12993
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12994
16411
d2d30742b686 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16374
diff changeset
 12995
isError
d2d30742b686 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16374
diff changeset
 12996
    "true if process terminated with error"
d2d30742b686 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16374
diff changeset
 12997
d2d30742b686 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16374
diff changeset
 12998
    ^ status == #exit and:[code ~= 0]
d2d30742b686 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16374
diff changeset
 12999
!
d2d30742b686 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16374
diff changeset
 13000
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 13001
stillAlive
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 13002
    "true if process is still alive"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 13003
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 13004
    ^ status == #stop or:[status == #continue]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 13005
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 13006
    "Created: 28.12.1995 / 14:27:26 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 13007
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 13008
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 13009
success
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 13010
    "true if process terminated successfully"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 13011
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 13012
    ^ status == #exit and:[code = 0]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 13013
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 13014
    "Created: 28.12.1995 / 14:13:05 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 13015
    "Modified: 28.12.1995 / 14:13:41 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 13016
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 13017
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13018
!Win32OperatingSystem::PECOFFConstants class methodsFor:'documentation'!
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
documentation
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
    COFF machine type IDs.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13023
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13024
    [author:]
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13025
	Jan Vrany
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13026
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13027
    [instance variables:]
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13028
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13029
    [class variables:]
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13030
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13031
    [see also:]
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13032
	Microsoft Portable Executable and Common Object File Format Specification,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13033
	section 6. Machine Types
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
"
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13036
! !
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13037
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13038
!Win32OperatingSystem::PECOFFConstants class methodsFor:'initialization'!
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13039
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13040
initialize
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13041
    "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
 13042
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13043
    "/ See Microsoft Portable Executable and Common Object File Format Specification,
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13044
    "/ section 4
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13045
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13046
    PE_Signature_OFFSET_OFFSET := 16r3C.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13047
    PE_Signature := #[80 69 0 0].
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13048
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13049
    "/ See Microsoft Portable Executable and Common Object File Format Specification,
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13050
    "/ section 5
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13051
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13052
    COFF_HEADER_SIZE := 20.
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13053
    COFF_HEADER_Machine_OFFSET := 0.
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13054
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13055
    "/ See Microsoft Portable Executable and Common Object File Format Specification,
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13056
    "/ section 6
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
    IMAGE_FILE_MACHINE_UNKNOWN := 16r0.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13059
    IMAGE_FILE_MACHINE_AM33 := 16r1D3.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13060
    IMAGE_FILE_MACHINE_AMD64 := 16r8664.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13061
    IMAGE_FILE_MACHINE_ARM := 16r1C0.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13062
    IMAGE_FILE_MACHINE_ARMNT := 16r1C4.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13063
    IMAGE_FILE_MACHINE_ARM64 := 16rAA64.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13064
    IMAGE_FILE_MACHINE_EBC := 16rEBC.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13065
    IMAGE_FILE_MACHINE_I386 := 16r14C.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13066
    IMAGE_FILE_MACHINE_IA64 := 16r200.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13067
    IMAGE_FILE_MACHINE_M32R := 16r9041.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13068
    IMAGE_FILE_MACHINE_MIPS16 := 16r266.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13069
    IMAGE_FILE_MACHINE_MIPSFPU := 16r366.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13070
    IMAGE_FILE_MACHINE_MIPSFPU16 := 16r466.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13071
    IMAGE_FILE_MACHINE_POWERPC := 16r1F0.
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13072
    IMAGE_FILE_MACHINE_POWEPCFP := 16r1F1.
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13073
    IMAGE_FILE_MACHINE_R4000 := 16r166.
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13074
    IMAGE_FILE_MACHINE_SH3 := 16r1A2.
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13075
    IMAGE_FILE_MACHINE_SH3DSP := 16r1A3.
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13076
    IMAGE_FILE_MACHINE_SH4 := 16r1A6.
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13077
    IMAGE_FILE_MACHINE_SH5 := 16r1A8.
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13078
    IMAGE_FILE_MACHINE_THUMB := 16r1C2.
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13079
    IMAGE_FILE_MACHINE_WCEMIPSV2 := 16r169.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13080
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13081
    "Modified: / 16-03-2015 / 13:34:57 / jv"
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13082
    "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
 13083
! !
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13084
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13085
!Win32OperatingSystem::PECOFFFileHeader class methodsFor:'documentation'!
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13086
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13087
documentation
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13088
"
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13089
    Inteances of COFFFileHeader provides an access to various
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13090
    information about executables / .dlls on Windows
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13091
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13092
    [author:]
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13093
	Jan Vrany <jan.vrany@fit.cvut.cz>
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13094
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13095
    [instance variables:]
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13096
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13097
    [class variables:]
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13098
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13099
    [see also:]
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13100
	Microsoft Portable Executable and Common Object File Format Specification
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13101
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13102
"
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13103
! !
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13104
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13105
!Win32OperatingSystem::PECOFFFileHeader class methodsFor:'instance creation'!
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13106
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13107
fromFile: aStringOrFilename
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13108
    "Returns a COFFFileHeader of given file.
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13109
     If the given file is not a regular file or
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13110
     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
 13111
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13112
    ^ self new initializeOnFile: aStringOrFilename
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13113
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13114
    "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
 13115
! !
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13116
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13117
!Win32OperatingSystem::PECOFFFileHeader methodsFor:'accessing'!
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13118
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13119
machine
19367
b7eef79ceeb8 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19346
diff changeset
 13120
   ^ data unsignedInt16At: COFF_HEADER_Machine_OFFSET + 1 MSB: false
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13121
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13122
    "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
 13123
! !
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13124
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13125
!Win32OperatingSystem::PECOFFFileHeader methodsFor:'initialization'!
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13126
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13127
initializeOnFile: aStringOrFilename
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13128
    file := aStringOrFilename asFilename.
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13129
    file exists ifFalse:[
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13130
	self error:'Given file does not exist'.
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13131
	^ nil
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13132
    ].
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13133
    file isRegularFile ifFalse:[
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13134
	self error:'Given file is not a regular file'.
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13135
	^ nil
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13136
    ].
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13137
    file readingFileDo:[ :s |
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13138
	| sig |
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13139
	s binary.
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13140
	s position: PE_Signature_OFFSET_OFFSET.
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13141
	s position: (s nextUnsignedLongMSB: false).
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13142
	sig := s next: PE_Signature size.
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13143
	sig = PE_Signature ifFalse:[
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13144
	    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
 13145
	    ^ nil
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13146
	].
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 13147
	data := s next: COFF_HEADER_SIZE
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13148
    ].
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13149
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13150
    "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
 13151
! !
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13152
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13153
!Win32OperatingSystem::PECOFFFileHeader methodsFor:'queries'!
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13154
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13155
isFor32BitArchitecture
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13156
    ^ { 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
 13157
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13158
    "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
 13159
!
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13160
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13161
isFor64BitArchitecture
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13162
    ^ { 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
 13163
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13164
    "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
 13165
! !
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 13166
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13167
!Win32OperatingSystem::PerformanceData class methodsFor:'accessing'!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13168
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13169
counterIndexTextDictionary
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13170
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13171
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13172
	self counterIndexTextDictionary
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13173
    "
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13174
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13175
    CounterIndexTextDictionary isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13176
	self synchronized:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13177
	    CounterIndexTextDictionary isNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13178
		|performanceText counterIndexTextDictionary|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13179
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13180
		performanceText := self getPerformanceText valueNamed:'Counter'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13181
		counterIndexTextDictionary := IdentityDictionary new.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13182
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13183
		1 to:performanceText size by:2 do:[:index|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13184
		    counterIndexTextDictionary at:(performanceText at:index) asInteger put:(performanceText at:index + 1).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13185
		].
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
		CounterIndexTextDictionary := counterIndexTextDictionary.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13188
	    ].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13189
	].
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13190
    ].
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13191
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13192
    ^ CounterIndexTextDictionary
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13193
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13194
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13195
helpIndexTextDictionary
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13196
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13197
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13198
	self helpIndexTextDictionary
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13199
    "
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13200
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13201
    HelpIndexTextDictionary isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13202
	self synchronized:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13203
	    HelpIndexTextDictionary isNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13204
		|performanceText helpIndexTextDictionary|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13205
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13206
		performanceText := self getPerformanceText valueNamed:'Help'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13207
		helpIndexTextDictionary := IdentityDictionary new.
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
		1 to:performanceText size by:2 do:[:index|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13210
		    helpIndexTextDictionary at:(performanceText at:index) asInteger put:(performanceText at:index + 1).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13211
		].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13212
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13213
		HelpIndexTextDictionary := helpIndexTextDictionary.
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
	].
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13216
    ].
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13217
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13218
    ^ HelpIndexTextDictionary
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13219
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13220
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13221
!Win32OperatingSystem::PerformanceData class methodsFor:'accessing subclasses'!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13222
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13223
diskIO
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13224
    ^ DiskIO current
10688
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
 13225
!
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
 13226
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13227
global
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13228
    ^ Global current
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13229
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13230
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13231
memory
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13232
    ^ Memory current
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13233
!
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13234
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13235
network
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13236
    ^ Network current
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13237
!
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13238
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13239
process
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13240
    ^ Process current
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13241
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13242
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13243
processor
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13244
    ^ Processor current
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13245
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13246
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13247
!Win32OperatingSystem::PerformanceData class methodsFor:'documentation'!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13248
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13249
documentation
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13250
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13251
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13252
	VISTA:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13253
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 13254
	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
 13255
	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
 13256
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13257
	Um dies zu umgehen:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13258
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13259
	To turn off UAC
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13260
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13261
	1. Click Start, and then click Control Panel.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13262
	2. In Control Panel, click User Accounts.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13263
	3. In the User Accounts window, click User Accounts.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13264
	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
 13265
	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
 13266
	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
 13267
	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
 13268
    "
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13269
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13270
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13271
examples
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13272
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13273
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13274
	######################################### PRIMITIVE
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13275
	self getUsedMemoryInPercentage.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13276
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13277
	self getPhysicalMemoryInKB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13278
	self getPhysicalMemoryInMB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13279
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13280
	self getFreePhysicalMemoryInKB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13281
	self getFreePhysicalMemoryInMB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13282
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13283
	self getPageFileSizeInKB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13284
	self getPageFileSizeInMB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13285
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13286
	self getFreePageFileSizeInKB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13287
	self getFreePageFileSizeInMB.
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
	self getVirtualMemoryInKB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13290
	self getVirtualMemoryInMB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13291
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13292
	######################################### REGISTRY
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13293
	self helpIndexTextDictionary
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13294
	self counterIndexTextDictionary
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13295
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13296
	self global getCounterNameIndexArray.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13297
	self global getObjectNameIndexArray.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13298
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13299
	self processor getCounterNameIndexArray.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13300
	self processor processorUsage.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13301
	self processor processorUsageFromLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13302
	self processor interruptsPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13303
	self processor interruptsPerSecondFromLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13304
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13305
	self process getCounterNameIndexArray.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13306
	self process processUsage.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13307
	self process processUsageFromLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13308
	self process runningProcesses.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13309
	self process runningProcessNameList.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13310
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13311
	self network getCounterNameIndexArray.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13312
	self network kBytesReceivedPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13313
	self network kBytesReceivedPerSecondFromLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13314
	self network kBytesSentPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13315
	self network kBytesSentPerSecondFromLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13316
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13317
	self memory getCounterNameIndexArray.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13318
	self memory availableMBytes.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13319
	self memory availableKBytes.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13320
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13321
	self diskIO getCounterNameIndexArray.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13322
	self diskIO diskSpaceFreeInMegaByte.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13323
	self diskIO diskQueueLength.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13324
	self diskIO diskTransfersPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13325
	self diskIO diskTransfersPerSecondFromlast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13326
	self diskIO diskReadsPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13327
	self diskIO diskReadsPerSecondFromLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13328
	self diskIO diskWritesPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13329
	self diskIO diskWritesPerSecondFromLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13330
	self diskIO diskBytesPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13331
	self diskIO diskBytesPerSecondFromLast.
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13332
    "
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13333
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13334
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13335
!Win32OperatingSystem::PerformanceData class methodsFor:'initialization'!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13336
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13337
initialize
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13338
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13339
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13340
	self initialize
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13341
    "
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13342
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13343
    PerformanceText := CounterIndexTextDictionary := HelpIndexTextDictionary := nil.
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13344
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13345
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13346
!Win32OperatingSystem::PerformanceData class methodsFor:'private'!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13347
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13348
getPerformanceText
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13349
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13350
    PerformanceText isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13351
	PerformanceText := Win32OperatingSystem registryEntry key:'HKEY_PERFORMANCE_TEXT'.
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13352
    ].
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13353
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13354
    ^ PerformanceText
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13355
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13356
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13357
!Win32OperatingSystem::PerformanceData class methodsFor:'queries - memory'!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13358
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13359
getFreePageFileSizeInKB
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13360
    |ret|
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13361
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13362
    %{
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13363
	MEMORYSTATUS mState;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13364
	GlobalMemoryStatus (&mState);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13365
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13366
	ret = __mkSmallInteger(mState.dwAvailPageFile / 1024);
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13367
    %}.
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13368
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13369
    ^ ret
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13370
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13371
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13372
	self getFreePageFileSizeInKB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13373
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13374
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13375
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13376
getFreePageFileSizeInMB
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13377
    ^ (self getFreePageFileSizeInKB / 1024) asInteger
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13378
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13379
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13380
	self getFreePageFileSizeInMB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13381
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13382
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13383
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13384
getFreePhysicalMemoryInKB
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13385
    |ret|
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13386
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13387
    %{
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13388
	MEMORYSTATUS mState;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13389
	GlobalMemoryStatus (&mState);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13390
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13391
	ret = __mkSmallInteger(mState.dwAvailPhys / 1024);
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13392
    %}.
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13393
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13394
    ^ ret
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
 13395
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
 13396
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13397
	self getFreePhysicalMemoryInKB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13398
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13399
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13400
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13401
getFreePhysicalMemoryInMB
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13402
    ^ (self getFreePhysicalMemoryInKB / 1024) asInteger
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13403
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13404
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13405
	self getFreePhysicalMemoryInMB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13406
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13407
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13408
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13409
getPageFileSizeInKB
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13410
    ^ self getPageFileSizeInMB * 1024
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13411
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13412
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13413
	self getPageFileSizeInKB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13414
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13415
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13416
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13417
getPageFileSizeInMB
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13418
    |ret|
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13419
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13420
    %{
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13421
	SYSTEM_INFO sInfo;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13422
	GetSystemInfo(&sInfo);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13423
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13424
	ret = __mkSmallInteger(sInfo.dwPageSize);
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13425
    %}.
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13426
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13427
    ^ ret
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13428
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13429
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13430
	self getPageFileSizeInMB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13431
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13432
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13433
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13434
getPhysicalMemoryInKB
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13435
    |ret|
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13436
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13437
    %{
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13438
	MEMORYSTATUS mState;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13439
	GlobalMemoryStatus (&mState);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13440
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13441
	ret = __mkSmallInteger(mState.dwTotalPhys / 1024);
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13442
    %}.
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13443
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13444
    ^ ret
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13445
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13446
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13447
	self getPhysicalMemoryInKB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13448
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13449
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13450
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13451
getPhysicalMemoryInMB
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13452
    ^ (self getPhysicalMemoryInKB / 1024) asInteger
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13453
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13454
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13455
	self getPhysicalMemoryInMB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13456
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13457
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13458
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13459
getUsedMemoryInPercentage
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13460
    |ret|
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13461
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13462
    %{
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13463
	MEMORYSTATUS mState;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13464
	GlobalMemoryStatus (&mState);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13465
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13466
	ret = __mkSmallInteger(mState.dwMemoryLoad);
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13467
    %}.
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13468
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13469
    ^ ret
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13470
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13471
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13472
	self getUsedMemoryInPercentage
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13473
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13474
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13475
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13476
getVirtualMemoryInKB
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13477
    |ret|
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13478
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13479
    %{
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13480
	MEMORYSTATUS mState;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13481
	GlobalMemoryStatus (&mState);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13482
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13483
	ret = __mkSmallInteger(mState.dwTotalVirtual / 1024);
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13484
    %}.
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13485
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13486
    ^ ret
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13487
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 13488
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13489
	self getVirtualMemoryInKB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13490
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13491
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13492
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13493
getVirtualMemoryInMB
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13494
    ^ (self getVirtualMemoryInKB / 1024) asInteger
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13495
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13496
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13497
	self getVirtualMemoryInMB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13498
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13499
! !
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 13500
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13501
!Win32OperatingSystem::PerformanceData methodsFor:'accessing'!
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13502
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13503
objectArray
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13504
    ^ objectArray
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13505
!
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13506
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13507
perfFreq
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13508
    ^ perfFreq
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13509
!
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13510
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13511
perfTime
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13512
    ^ perfTime
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13513
!
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13514
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13515
perfTime100nSec
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13516
    ^ perfTime100nSec
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13517
! !
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13518
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13519
!Win32OperatingSystem::PerformanceData methodsFor:'setup'!
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13520
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13521
fromRawBytes:st_data
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13522
    |
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13523
    getNameBlock getCounterValueBlock
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13524
    st_perfTime st_perfFreq st_perfTime100nSec
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13525
    st_objectArray st_counterArray st_instanceArray
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13526
    st_perObject st_perCounter st_perInstance
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13527
    |
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13528
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13529
%{
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13530
    //declarate counters
10741
68517f1a68a7 *** empty log message ***
sr
parents: 10735
diff changeset
 13531
    int objectIterator, counterIterator, instanceIterator, numObjectTypes;
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13532
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13533
    //declarate pointers
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13534
    PERF_DATA_BLOCK *perfData;
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13535
    PERF_OBJECT_TYPE *perfObjectPtr;
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13536
    PERF_COUNTER_DEFINITION *perfCounterPtr;
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13537
    PERF_INSTANCE_DEFINITION *perfInstancePtr;
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13538
    PERF_COUNTER_BLOCK *perfCounterBlockPtr;
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13539
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13540
    #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
 13541
    #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
 13542
    #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
 13543
#ifdef PERF_COUNTER_PRECISION
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13544
    #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
 13545
#else
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 13546
    #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
 13547
#endif
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13548
    #define PERF_TEXTTYPE_MASK    (PERF_TEXT_UNICODE|PERF_TEXT_ASCII)
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13549
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13550
    if (!__isByteArray(st_data)) RETURN (nil);
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13551
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13552
    //setup start pointer
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13553
    perfData = (PERF_DATA_BLOCK *)(__ByteArrayInstPtr(st_data)->ba_element);
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13554
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13555
    //get header data
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13556
    st_perfTime = __MKINT64(&(perfData->PerfTime));
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13557
    st_perfFreq = __MKINT64(&(perfData->PerfFreq));
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13558
    st_perfTime100nSec = __MKINT64(&(perfData->PerfTime100nSec));
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13559
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13560
    //setup object array and initialize its pointer
10741
68517f1a68a7 *** empty log message ***
sr
parents: 10735
diff changeset
 13561
    numObjectTypes = perfData->NumObjectTypes;
68517f1a68a7 *** empty log message ***
sr
parents: 10735
diff changeset
 13562
    st_objectArray = __ARRAY_NEW_INT(numObjectTypes);
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13563
    perfObjectPtr = (PERF_OBJECT_TYPE *)((char *)perfData + perfData->HeaderLength);
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13564
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13565
    //iterate all following objetcs
10741
68517f1a68a7 *** empty log message ***
sr
parents: 10735
diff changeset
 13566
    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
 13567
	//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
 13568
	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
 13569
	__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
 13570
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13571
	//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
 13572
	__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
 13573
	__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
 13574
	__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
 13575
	__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
 13576
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13577
	//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
 13578
	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
 13579
	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
 13580
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13581
	//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
 13582
	__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
 13583
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13584
	//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
 13585
	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
 13586
	    //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
 13587
	    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
 13588
	    __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
 13589
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13590
	    //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
 13591
	    __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
 13592
	    __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
 13593
	    __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
 13594
	    __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
 13595
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13596
	    //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
 13597
	    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
 13598
		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
 13599
		    __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
 13600
		    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13601
		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
 13602
		    __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
 13603
		    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13604
		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
 13605
		    __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
 13606
		    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13607
		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
 13608
		    __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
 13609
		    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13610
	    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13611
	    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
 13612
		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
 13613
		    __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
 13614
		    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
 13615
			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
 13616
			    __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
 13617
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13618
			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
 13619
			    __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
 13620
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13621
			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
 13622
			    __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
 13623
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13624
		    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13625
		    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13626
		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
 13627
		    __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
 13628
		    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
 13629
			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
 13630
			    __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
 13631
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13632
			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
 13633
			    __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
 13634
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13635
			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
 13636
			    __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
 13637
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13638
			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
 13639
			    __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
 13640
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13641
			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
 13642
			    __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
 13643
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13644
			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
 13645
			    __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
 13646
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13647
			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
 13648
			    __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
 13649
			    break;
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 13650
#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
 13651
			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
 13652
			    __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
 13653
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13654
#endif
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13655
		    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13656
		    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13657
		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
 13658
		    __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
 13659
		    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
 13660
			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
 13661
			    __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
 13662
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13663
			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
 13664
			    __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
 13665
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13666
		    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13667
		    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13668
		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
 13669
		    __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
 13670
		    break;
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
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13673
	    //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
 13674
	    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
 13675
	}
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
	//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
 13678
	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
 13679
	    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
 13680
	    __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
 13681
	} else {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13682
	    //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
 13683
	    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
 13684
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13685
	    //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
 13686
	    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
 13687
	    __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
 13688
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13689
	    //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
 13690
	    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
 13691
		//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
 13692
		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
 13693
		__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
 13694
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13695
		//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
 13696
		__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
 13697
		__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
 13698
		__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
 13699
		__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
 13700
		__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
 13701
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13702
		//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
 13703
		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
 13704
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13705
		//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
 13706
		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
 13707
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13708
		//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
 13709
		__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
 13710
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13711
		//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
 13712
		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
 13713
	    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13714
	}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13715
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13716
	//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
 13717
	perfObjectPtr = (PERF_OBJECT_TYPE *)((char *)perfObjectPtr + perfObjectPtr->TotalByteLength);
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13718
    }
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13719
%}.
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13720
    objectArray := st_objectArray.
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13721
    perfTime := st_perfTime.
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13722
    perfFreq := st_perfFreq.
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13723
    perfTime100nSec := st_perfTime100nSec.
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13724
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13725
    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
 13726
	self class counterIndexTextDictionary at:i ifAbsent:['<<no name>>'].
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13727
    ].
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13728
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13729
    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
 13730
	|offset counterValue|
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13731
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13732
	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
 13733
	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
 13734
	    counterValue := nil.
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13735
	] ifFalse:[
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13736
	    (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
 13737
		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
 13738
	    ] ifFalse:[
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13739
		(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
 13740
		    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
 13741
		] ifFalse:[
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13742
		    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
 13743
		].
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13744
	    ].
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13745
	].
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13746
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13747
	counterValue
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13748
    ].
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13749
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13750
    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
 13751
	"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
 13752
	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
 13753
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13754
	"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
 13755
	(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
 13756
	    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
 13757
	    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
 13758
	].
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13759
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13760
	(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
 13761
	    |rawData|
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13762
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13763
	    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
 13764
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13765
	    (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
 13766
		(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
 13767
	    ].
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13768
	] ifFalse:[
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13769
	    (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
 13770
		|rawData|
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13771
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13772
		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
 13773
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13774
		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
 13775
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13776
		(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
 13777
		    (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
 13778
		].
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13779
	    ].
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13780
	].
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13781
    ].
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13782
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13783
    ^ self
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13784
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13785
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13786
!Win32OperatingSystem::PerformanceData::Abstract methodsFor:'accessing'!
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13787
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13788
cachedResults
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13789
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13790
    cachedResults isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13791
	cachedResults := IdentityDictionary new.
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13792
    ].
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13793
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13794
    ^ cachedResults
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13795
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13796
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13797
lastData
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13798
    ^ lastData
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13799
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13800
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13801
lastData:something
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13802
    lastData := something.
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13803
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13804
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13805
lastTimestamp
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13806
    ^ lastTimestamp
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13807
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13808
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13809
lastTimestamp:something
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13810
    lastTimestamp := something.
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13811
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13812
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13813
!Win32OperatingSystem::PerformanceData::Abstract methodsFor:'definitions'!
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13814
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13815
aliveTime
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13816
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13817
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13818
	returns the time a data stays alive, in milliseconds
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13819
	before we push a new call and overwrite the data
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13820
    "
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13821
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13822
    ^ self subclassResponsibility
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13823
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13824
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13825
indexedName
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13826
    ^ self subclassResponsibility
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13827
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13828
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13829
indexedNameNumbered
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13830
    ^ self indexedName asInteger
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13831
!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13832
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13833
timedQueryMilliseconds
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13834
    ^ 100
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13835
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13836
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13837
!Win32OperatingSystem::PerformanceData::Abstract methodsFor:'private'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13838
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13839
data
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13840
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13841
    self synchronized:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13842
	|lastTS|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13843
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13844
	lastTS := self lastTimestamp.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13845
	lastTS isNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13846
	    ^ self dataBasic
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13847
	] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13848
	    Timestamp now asMilliseconds - lastTS >= self aliveTime ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13849
		^ self dataBasic
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13850
	    ] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13851
		^ self lastData
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13852
	    ].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13853
	].
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13854
    ].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13855
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13856
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13857
dataBasic
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13858
    |regEntry|
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13859
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13860
    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
 13861
    self assert:(regEntry notNil).
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13862
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13863
    self lastTimestamp:Timestamp now asMilliseconds.
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13864
    self lastData:(Win32OperatingSystem::PerformanceData new fromRawBytes:regEntry).
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13865
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13866
    ^ self lastData
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13867
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13868
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13869
!Win32OperatingSystem::PerformanceData::Abstract methodsFor:'queries'!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13870
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13871
getCounterNameIndexArray
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13872
    |data object debugBlock|
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13873
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13874
    data := self data.
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13875
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13876
    self indexedNameNumbered == 0 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13877
	object := data objectArray at:1 ifAbsent:[debugBlock value:(object at:#ObjectNameTitle)].
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13878
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13879
	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
 13880
    ].
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13881
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13882
    ^ (object at:#Counters) collect:[:el|Array with:(el at:#CounterNameTitle) with:(el at:#CounterNameTitleIndex)].
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13883
! !
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13884
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13885
!Win32OperatingSystem::PerformanceData::Abstract methodsFor:'queries - timed'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13886
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13887
getPerSecondFromLast:aSelector
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13888
    |cachedResult return|
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13889
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13890
    cachedResult := self cachedResults at:aSelector ifAbsent:nil.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13891
    cachedResult notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13892
	|currentResult|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13893
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13894
	currentResult := self perform:aSelector.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13895
	return := self getPerSecondViaResult1:cachedResult result2:currentResult.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13896
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13897
	self cachedResults at:aSelector put:currentResult.
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13898
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13899
	self cachedResults at:aSelector put:(self perform:aSelector).
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13900
    ].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13901
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13902
    ^ return
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13903
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13904
10701
b8c876510d1d *** empty log message ***
sr
parents: 10699
diff changeset
 13905
getPerSecondViaPerformBlock:performBlock
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13906
    |result1 result2 runTimeInNS runTimeInS values1 values2 globalResult|
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13907
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13908
    self assert:(self aliveTime < self timedQueryMilliseconds).
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13909
10701
b8c876510d1d *** empty log message ***
sr
parents: 10699
diff changeset
 13910
    result1 := performBlock value.
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13911
    Delay waitForMilliseconds:self timedQueryMilliseconds.
10701
b8c876510d1d *** empty log message ***
sr
parents: 10699
diff changeset
 13912
    result2 := performBlock value.
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13913
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13914
    runTimeInNS := ((result2 at:#time100nSec) - (result1 at:#time100nSec)) * 100.
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13915
    runTimeInS := runTimeInNS / 1000 / 1000 / 1000.
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13916
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13917
    values1 := result1 at:#values.
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13918
    values2 := result2 at:#values.
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13919
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13920
    globalResult := Dictionary new.
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13921
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13922
    values2 keysDo:[:key|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13923
	|difference|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13924
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13925
	difference := (values2 at:key) - (values1 at:key).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13926
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13927
	runTimeInS = 0 ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13928
	    globalResult at:key put:0.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13929
	] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13930
	    globalResult at:key put:(difference / runTimeInS) asFloat.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13931
	].
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13932
    ].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13933
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13934
    ^ globalResult
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13935
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13936
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13937
getPerSecondViaResult1:result1 result2:result2
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13938
    |runTimeInNS runTimeInS values1 values2 globalResult|
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13939
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13940
    runTimeInNS := ((result2 at:#time100nSec) - (result1 at:#time100nSec)) * 100.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13941
    runTimeInS := runTimeInNS / 1000 / 1000 / 1000.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13942
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13943
    values1 := result1 at:#values.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13944
    values2 := result2 at:#values.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13945
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13946
    globalResult := Dictionary new.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13947
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13948
    values2 keysDo:[:key|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13949
	|difference|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13950
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13951
	difference := (values2 at:key) - (values1 at:key).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13952
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13953
	runTimeInS = 0 ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13954
	    globalResult at:key put:0.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13955
	] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13956
	    globalResult at:key put:(difference / runTimeInS) asFloat.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13957
	].
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13958
    ].
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13959
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13960
    ^ globalResult
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13961
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13962
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13963
getUsageFromLast:aSelector
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13964
    |cachedResult return|
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13965
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13966
    cachedResult := self cachedResults at:aSelector ifAbsent:nil.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13967
    cachedResult notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13968
	|currentResult|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13969
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13970
	currentResult := self perform:aSelector.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13971
	return := self getUsageViaResult1:cachedResult result2:currentResult.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13972
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13973
	self cachedResults at:aSelector put:currentResult.
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13974
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13975
	self cachedResults at:aSelector put:(self perform:aSelector).
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13976
    ].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13977
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13978
    ^ return
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13979
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13980
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13981
getUsageViaPerformBlock:performBlock
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13982
    |result1 result2 deltaTIn100Ns value1 value2 globalResult|
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13983
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13984
    self assert:(self aliveTime < self timedQueryMilliseconds).
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13985
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13986
    result1 := performBlock value.
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13987
    Delay waitForMilliseconds:self timedQueryMilliseconds.
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13988
    result2 := performBlock value.
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13989
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13990
    globalResult := Dictionary new.
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13991
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13992
    deltaTIn100Ns := (result2 at:#time100nSec) - (result1 at:#time100nSec).
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13993
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13994
    value1 := result1 at:#values.
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13995
    value2 := result2 at:#values.
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13996
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13997
    value1 keysDo:[:key|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13998
	|diff dPerSecond load1024 res|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13999
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14000
	diff := (value2 at:key) - (value1 at:key).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14001
	diff := diff bitShift:10.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14002
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14003
	deltaTIn100Ns = 0 ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14004
	    dPerSecond := 0.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14005
	] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14006
	    dPerSecond := (diff / deltaTIn100Ns) asFloat.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14007
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14008
	load1024 := 1024 - dPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14009
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14010
	res := (load1024 / 1024 * 100) asFloat.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14011
	res < 0 ifTrue:[res := 0].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14012
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14013
	globalResult at:key put:res.
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14014
    ].
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14015
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14016
    ^ globalResult
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14017
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14018
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14019
getUsageViaResult1:result1 result2:result2
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14020
    |deltaTIn100Ns value1 value2 globalResult|
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14021
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14022
    globalResult := Dictionary new.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14023
    deltaTIn100Ns := (result2 at:#time100nSec) - (result1 at:#time100nSec).
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14024
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14025
    value1 := result1 at:#values.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14026
    value2 := result2 at:#values.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14027
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14028
    value1 keysDo:[:key|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14029
	|diff dPerSecond load1024 res|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14030
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14031
	diff := (value2 at:key) - (value1 at:key).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14032
	diff := diff bitShift:10.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14033
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14034
	deltaTIn100Ns = 0 ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14035
	    dPerSecond := 0.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14036
	] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14037
	    dPerSecond := (diff / deltaTIn100Ns) asFloat.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14038
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14039
	load1024 := 1024 - dPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14040
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14041
	res := (load1024 / 1024 * 100) asFloat.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14042
	res < 0 ifTrue:[res := 0].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14043
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14044
	globalResult at:key put:res.
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14045
    ].
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14046
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14047
    ^ globalResult
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14048
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14049
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14050
!Win32OperatingSystem::PerformanceData::Abstract methodsFor:'queries - values'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14051
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14052
getBasicValuesByCounter:counterIndex
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14053
    ^ self getBasicValuesByObject:0 counter:counterIndex timed:false
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14054
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14055
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 14056
getBasicValuesByCounter:counterIndex timed:aBoolean
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 14057
    ^ self getBasicValuesByObject:0 counter:counterIndex timed:aBoolean
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14058
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14059
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14060
getBasicValuesByObject:objectIndex counter:counterIndex
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14061
    ^ self getBasicValuesByObject:0 counter:counterIndex timed:false
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14062
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14063
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 14064
getBasicValuesByObject:objectIndex counter:counterIndex timed:aBoolean
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14065
    |data object counter values debugBlock numInstances|
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14066
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14067
    debugBlock := [:obj|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14068
	^ 'obj:', obj , ' this:', self printString , ' idx:', self indexedName
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14069
    ].
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14070
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14071
    data := self dataBasic.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14072
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14073
    objectIndex == 0 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14074
	object := data objectArray at:1 ifAbsent:[debugBlock value:(object at:#ObjectNameTitle)].
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14075
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14076
	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
 14077
    ].
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14078
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14079
    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
 14080
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14081
    values := Dictionary new.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14082
    numInstances := object at:#NumInstances.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14083
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14084
    numInstances > 0 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14085
	1 to:numInstances do:[:idx|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14086
	    |value instanceName|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14087
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14088
	    value := (counter at:#CounterValueArray) at:idx.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14089
	    instanceName := ((object at:#Instances) at:idx) at:#Name.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14090
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14091
	    values at:instanceName put:value.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14092
	].
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14093
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14094
	values at:'<<singleton>>' put:(counter at:#CounterValueArray) first.
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14095
    ].
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14096
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 14097
    aBoolean ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14098
	|return|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14099
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14100
	return := IdentityDictionary new.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14101
	return at:#time put:data perfTime.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14102
	return at:#frequence put:data perfFreq.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14103
	return at:#time100nSec put:data perfTime100nSec.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14104
	return at:#values put:values.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14105
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14106
	^ return
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14107
    ].
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14108
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14109
    ^ values
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14110
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14111
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14112
getValuesByCounter:counterIndex
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14113
    ^ self getValuesByObject:0 counter:counterIndex timed:false
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14114
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14115
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 14116
getValuesByCounter:counterIndex timed:aBoolean
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 14117
    ^ self getValuesByObject:0 counter:counterIndex timed:aBoolean
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14118
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14119
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14120
getValuesByObject:objectIndex counter:counterIndex
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14121
    ^ self getValuesByObject:0 counter:counterIndex timed:false
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14122
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14123
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 14124
getValuesByObject:objectIndex counter:counterIndex timed:aBoolean
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14125
    |data object counter values debugBlock numInstances|
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14126
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14127
    debugBlock := [:obj|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14128
	^ 'obj:', obj , ' this:', self printString , ' idx:', self indexedName
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14129
    ].
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14130
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14131
    data := self data.
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14132
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14133
    objectIndex == 0 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14134
	object := data objectArray at:1 ifAbsent:[debugBlock value:(object at:#ObjectNameTitle)].
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14135
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14136
	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
 14137
    ].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14138
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14139
    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
 14140
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14141
    values := Dictionary new.
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14142
    numInstances := object at:#NumInstances.
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14143
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14144
    numInstances > 0 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14145
	1 to:numInstances do:[:idx|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14146
	    |value instanceName|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14147
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14148
	    value := (counter at:#CounterValueArray) at:idx.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14149
	    instanceName := ((object at:#Instances) at:idx) at:#Name.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14150
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14151
	    values at:instanceName put:value.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14152
	].
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14153
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14154
	values at:'<<singleton>>' put:(counter at:#CounterValueArray) first.
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14155
    ].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14156
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 14157
    aBoolean ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14158
	|return|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14159
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14160
	return := IdentityDictionary new.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14161
	return at:#time put:data perfTime.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14162
	return at:#frequence put:data perfFreq.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14163
	return at:#time100nSec put:data perfTime100nSec.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14164
	return at:#values put:values.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14165
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14166
	^ return
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14167
    ].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14168
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14169
    ^ values
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
!Win32OperatingSystem::PerformanceData::DiskIO class methodsFor:'accessing'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14173
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14174
current
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14175
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14176
    TheOneAndOnlyInstance isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14177
	TheOneAndOnlyInstance := self new.
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
    ^ TheOneAndOnlyInstance
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14181
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14182
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14183
!Win32OperatingSystem::PerformanceData::DiskIO methodsFor:'definition'!
10688
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
 14184
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
 14185
aliveTime
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14186
    ^ 80
10688
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
 14187
!
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
 14188
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
 14189
indexedName
10704
5063fe06352c *** empty log message ***
sr
parents: 10702
diff changeset
 14190
    ^ '236'
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14191
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14192
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14193
!Win32OperatingSystem::PerformanceData::DiskIO methodsFor:'queries'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14194
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14195
diskBytes
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14196
    ^ self getValuesByCounter:218 timed:true
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14197
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14198
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14199
	self current diskBytes
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14200
    "
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14201
!
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14202
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14203
diskBytesBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14204
    ^ self getBasicValuesByCounter:218 timed:true
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14205
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14206
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14207
	self current diskBytesBasic
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14208
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14209
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14210
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14211
diskBytesPerSecond
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14212
    ^ self getPerSecondViaPerformBlock:[self diskBytes]
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14213
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14214
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14215
	self current diskBytesPerSecond
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14216
    "
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14217
!
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14218
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14219
diskBytesPerSecondFromLast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14220
    ^ self getPerSecondFromLast:#diskBytesBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14221
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14222
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14223
	self current diskBytesPerSecondFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14224
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14225
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14226
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14227
diskQueueLength
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14228
    ^ self getValuesByCounter:198
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14229
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14230
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14231
	self current diskQueueLength
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14232
    "
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14233
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14234
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14235
diskRead
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14236
    ^ self getValuesByCounter:214 timed:true
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14237
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14238
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14239
	self current diskRead
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14240
    "
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14241
!
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14242
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14243
diskReadBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14244
    ^ self getBasicValuesByCounter:214 timed:true
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14245
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14246
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14247
	self current diskReadBasic
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14248
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14249
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14250
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14251
diskReadsPerSecond
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14252
    ^ self getPerSecondViaPerformBlock:[self diskRead]
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14253
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14254
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14255
	self current diskReadsPerSecond
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14256
    "
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14257
!
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14258
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14259
diskReadsPerSecondFromLast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14260
    ^ self getPerSecondFromLast:#diskReadBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14261
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14262
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14263
	self current diskReadsPerSecondFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14264
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14265
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14266
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14267
diskSpaceFreeInMegaByte
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14268
    ^ self getValuesByCounter:408
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14269
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14270
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14271
	self current diskSpaceFreeInMegaByte
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14272
    "
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14273
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14274
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14275
diskTransfers
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14276
    ^ self getValuesByCounter:212 timed:true
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14277
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14278
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14279
	self current diskTransfers
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14280
    "
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14281
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14282
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14283
diskTransfersBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14284
    ^ self getBasicValuesByCounter:212 timed:true
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14285
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14286
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14287
	self current diskTransfersBasic
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14288
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14289
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14290
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14291
diskTransfersPerSecond
10701
b8c876510d1d *** empty log message ***
sr
parents: 10699
diff changeset
 14292
    ^ self getPerSecondViaPerformBlock:[self diskTransfers]
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14293
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14294
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14295
	self current diskTransfersPerSecond
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14296
    "
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14297
!
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14298
10757
a5e2e0f500df *** empty log message ***
sr
parents: 10756
diff changeset
 14299
diskTransfersPerSecondFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14300
    ^ self getPerSecondFromLast:#diskTransfersBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14301
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14302
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14303
	self current diskTransfersPerSecondFromlast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14304
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14305
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14306
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14307
diskWrite
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14308
    ^ self getValuesByCounter:216 timed:true
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14309
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14310
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14311
	self current diskWrite
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14312
    "
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14313
!
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14314
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14315
diskWriteBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14316
    ^ self getBasicValuesByCounter:216 timed:true
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14317
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14318
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14319
	self current diskWriteBasic
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14320
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14321
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14322
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14323
diskWritesPerSecond
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14324
    ^ self getPerSecondViaPerformBlock:[self diskWrite]
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14325
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14326
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14327
	self current diskWritesPerSecond
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14328
    "
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14329
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14330
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14331
diskWritesPerSecondFromLast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14332
    ^ self getPerSecondFromLast:#diskWriteBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14333
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14334
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14335
	self current diskWritesPerSecondFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14336
    "
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14337
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14338
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14339
!Win32OperatingSystem::PerformanceData::Global class methodsFor:'accessing'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14340
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14341
current
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14342
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14343
    TheOneAndOnlyInstance isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14344
	TheOneAndOnlyInstance := self new.
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14345
    ].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14346
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14347
    ^ TheOneAndOnlyInstance
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14348
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14349
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14350
!Win32OperatingSystem::PerformanceData::Global methodsFor:'definitions'!
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14351
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14352
aliveTime
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14353
    ^ 200
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14354
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14355
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14356
indexedName
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14357
    ^ 'Global'
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14358
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14359
10706
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14360
!Win32OperatingSystem::PerformanceData::Global methodsFor:'queries'!
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14361
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14362
getCounterNameIndexArray
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14363
    self error:'Global implements objects only'.
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14364
!
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14365
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14366
getObjectNameIndexArray
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14367
    |data indexNameArray|
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14368
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14369
    data := self data.
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14370
    indexNameArray := OrderedCollection new.
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14371
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14372
    data objectArray do:[:anObject|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14373
	|index name|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14374
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14375
	index := anObject at:#ObjectNameTitleIndex.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14376
	name := Win32OperatingSystem::PerformanceData counterIndexTextDictionary at:index.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14377
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14378
	indexNameArray add:(Array with:name with:index).
10706
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14379
    ].
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14380
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14381
    ^ indexNameArray
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14382
! !
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 14383
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14384
!Win32OperatingSystem::PerformanceData::Memory class methodsFor:'accessing'!
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14385
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14386
current
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14387
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14388
    TheOneAndOnlyInstance isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14389
	TheOneAndOnlyInstance := self new.
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14390
    ].
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14391
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14392
    ^ TheOneAndOnlyInstance
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14393
! !
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14394
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14395
!Win32OperatingSystem::PerformanceData::Memory methodsFor:'definitions'!
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14396
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14397
aliveTime
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14398
    ^ 80
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14399
!
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14400
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14401
indexedName
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14402
    ^ '4'
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14403
! !
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14404
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14405
!Win32OperatingSystem::PerformanceData::Memory methodsFor:'queries'!
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14406
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14407
availableKBytes
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14408
    ^ self getValuesByCounter:1380
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14409
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14410
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14411
	self current availableKBytes
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14412
    "
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14413
!
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 14414
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14415
availableMBytes
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14416
    ^ self getValuesByCounter:1382
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14417
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14418
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14419
	self current availableMBytes
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14420
    "
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14421
! !
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 14422
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14423
!Win32OperatingSystem::PerformanceData::Network class methodsFor:'accessing'!
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14424
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14425
current
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14426
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14427
    TheOneAndOnlyInstance isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14428
	TheOneAndOnlyInstance := self new.
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14429
    ].
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14430
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14431
    ^ TheOneAndOnlyInstance
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14432
! !
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14433
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14434
!Win32OperatingSystem::PerformanceData::Network methodsFor:'definition'!
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14435
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14436
aliveTime
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14437
    ^ 80
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14438
!
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14439
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14440
indexedName
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14441
    ^ '510'
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14442
!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14443
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14444
timedQueryMilliseconds
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14445
    ^ 200
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14446
! !
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14447
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14448
!Win32OperatingSystem::PerformanceData::Network methodsFor:'queries'!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14449
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14450
bytesReceived
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14451
    ^ self getValuesByCounter:264 timed:true
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14452
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14453
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14454
	self current bytesReceived
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14455
    "
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14456
!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14457
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14458
bytesReceivedBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14459
    ^ self getBasicValuesByCounter:264 timed:true
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14460
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14461
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14462
	self current bytesReceivedBasic
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14463
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14464
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14465
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14466
bytesReceivedPerSecond
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14467
    ^ self getPerSecondViaPerformBlock:[self bytesReceived]
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14468
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14469
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14470
	self current bytesReceivedPerSecond
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14471
    "
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14472
!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14473
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14474
bytesReceivedPerSecondFromlast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14475
    ^ self getPerSecondFromLast:#bytesReceivedBasic
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 bytesReceivedPerSecondFromlast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14479
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14480
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14481
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14482
bytesSent
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14483
    ^ self getValuesByCounter:506 timed:true
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14484
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14485
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14486
	self current bytesSent
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14487
    "
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14488
!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14489
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14490
bytesSentBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14491
    ^ self getBasicValuesByCounter:506 timed:true
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14492
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14493
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14494
	self current bytesSentBasic
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14495
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14496
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14497
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14498
bytesSentPerSecond
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14499
    ^ self getPerSecondViaPerformBlock:[self bytesSent]
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14500
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14501
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14502
	self current bytesSentPerSecond
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14503
    "
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14504
!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14505
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14506
bytesSentPerSecondFromlast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14507
    ^ self getPerSecondFromLast:#bytesSentBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14508
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14509
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14510
	self current bytesSentPerSecondFromlast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14511
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14512
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14513
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14514
kBytesReceivedPerSecond
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14515
    |modifiedDictionary|
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14516
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14517
    modifiedDictionary := Dictionary new.
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14518
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14519
    (self getPerSecondViaPerformBlock:[self bytesReceived]) keysAndValuesDo:[:key :value|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14520
	modifiedDictionary at:key put:(value / 1024).
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14521
    ].
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14522
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14523
    ^ modifiedDictionary
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14524
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14525
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14526
	self current kBytesReceivedPerSecond
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14527
    "
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14528
!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14529
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14530
kBytesReceivedPerSecondFromLast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14531
    |return modifiedDictionary|
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14532
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14533
    return := self bytesReceivedPerSecondFromlast.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14534
    return isNil ifTrue:[^ nil].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14535
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14536
    modifiedDictionary := Dictionary new.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14537
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14538
    return keysAndValuesDo:[:key :value|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14539
	modifiedDictionary at:key put:(value / 1024).
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14540
    ].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14541
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14542
    ^ modifiedDictionary
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14543
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14544
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14545
	self current kBytesReceivedPerSecondFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14546
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14547
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14548
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14549
kBytesSentPerSecond
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14550
    |modifiedDictionary|
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14551
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14552
    modifiedDictionary := Dictionary new.
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14553
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 14554
    (self getPerSecondViaPerformBlock:[self bytesSent]) keysAndValuesDo:[:key :value|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14555
	modifiedDictionary at:key put:(value / 1024).
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14556
    ].
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14557
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14558
    ^ modifiedDictionary
1055a716e253 *** empty log message ***
sr
parents: 10709
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 kBytesSentPerSecond
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14562
    "
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14563
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14564
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14565
kBytesSentPerSecondFromLast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14566
    |return modifiedDictionary|
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14567
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14568
    return := self bytesSentPerSecondFromlast.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14569
    return isNil ifTrue:[^ nil].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14570
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14571
    modifiedDictionary := Dictionary new.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14572
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14573
    return keysAndValuesDo:[:key :value|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14574
	modifiedDictionary at:key put:(value / 1024).
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14575
    ].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14576
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14577
    ^ modifiedDictionary
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14578
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14579
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14580
	self current kBytesSentPerSecondFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14581
    "
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14582
! !
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 14583
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14584
!Win32OperatingSystem::PerformanceData::Process class methodsFor:'accessing'!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14585
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14586
current
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14587
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14588
    TheOneAndOnlyInstance isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14589
	TheOneAndOnlyInstance := self new.
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14590
    ].
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14591
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14592
    ^ TheOneAndOnlyInstance
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14593
! !
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14594
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14595
!Win32OperatingSystem::PerformanceData::Process methodsFor:'definition'!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14596
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14597
aliveTime
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14598
    ^ 80
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14599
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14600
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14601
indexedName
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14602
    ^ '230'
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14603
! !
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14604
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14605
!Win32OperatingSystem::PerformanceData::Process methodsFor:'queries'!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14606
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14607
processTime
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14608
    ^ self getValuesByCounter:6 timed:true
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14609
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14610
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14611
	self current processTime
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14612
    "
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14613
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14614
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14615
processTimeBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14616
    ^ self getBasicValuesByCounter:6 timed:true
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14617
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14618
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14619
	self current processTimeBasic
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14620
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14621
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14622
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14623
processUsage
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14624
    |modifiedDictionary|
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14625
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14626
    modifiedDictionary := Dictionary new.
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14627
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14628
    (self getUsageViaPerformBlock:[self processTime]) keysAndValuesDo:[:key :value|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14629
	modifiedDictionary at:key put:(100 - value).
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14630
    ].
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14631
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14632
    ^ modifiedDictionary
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14633
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14634
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14635
	self current processUsage
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14636
    "
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14637
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14638
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14639
processUsageFromLast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14640
    |return modifiedDictionary|
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14641
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14642
    return := self getUsageFromLast:#processTimeBasic.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14643
    return isNil ifTrue:[^ nil].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14644
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14645
    modifiedDictionary := Dictionary new.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14646
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14647
    return keysAndValuesDo:[:key :value|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14648
	modifiedDictionary at:key put:(100 - value).
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14649
    ].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14650
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14651
    ^ modifiedDictionary
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14652
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14653
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14654
	self current processUsageFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14655
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14656
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14657
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14658
runningProcessNameList
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14659
    "_Total ~ pseudo process; Idle ~ pseudo process represents the free resources"
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14660
    ^ (self data objectArray first at:#Instances) collect:[:el|el at:#Name]
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14661
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14662
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14663
	self current runningProcessNameList
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14664
    "
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14665
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14666
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14667
runningProcesses
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14668
    "_Total ~ pseudo process; Idle ~ pseudo process represents the free resources"
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14669
    ^ (self data objectArray first at:#NumInstances)
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14670
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14671
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14672
	self current runningProcesses
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14673
    "
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14674
! !
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14675
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14676
!Win32OperatingSystem::PerformanceData::Processor class methodsFor:'accessing'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14677
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14678
current
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14679
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14680
    TheOneAndOnlyInstance isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14681
	TheOneAndOnlyInstance := self new.
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14682
    ].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14683
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14684
    ^ TheOneAndOnlyInstance
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14685
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14686
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14687
!Win32OperatingSystem::PerformanceData::Processor methodsFor:'definitions'!
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14688
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14689
aliveTime
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14690
    ^ 80
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14691
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14692
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14693
indexedName
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14694
    ^ '238'
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14695
! !
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14696
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14697
!Win32OperatingSystem::PerformanceData::Processor methodsFor:'queries'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14698
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14699
interrupts
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14700
    ^ self getValuesByCounter:148 timed:true
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14701
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14702
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14703
	self current interrupts
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14704
    "
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14705
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14706
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14707
interruptsBasic
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14708
    ^ self getBasicValuesByCounter:148 timed:true
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14709
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14710
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14711
	self current interruptsBasic
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14712
    "
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14713
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14714
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14715
interruptsPerSecond
10701
b8c876510d1d *** empty log message ***
sr
parents: 10699
diff changeset
 14716
    ^ self getPerSecondViaPerformBlock:[self interrupts]
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14717
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14718
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14719
	self current interruptsPerSecond
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14720
    "
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14721
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14722
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14723
interruptsPerSecondFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14724
    ^ self getPerSecondFromLast:#interruptsBasic
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14725
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14726
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14727
	self current interruptsPerSecondFromLast
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14728
    "
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14729
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14730
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14731
processorTime
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14732
    ^ self getValuesByCounter:6 timed:true
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14733
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14734
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14735
	self current processorTime
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14736
    "
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14737
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14738
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14739
processorTimeBasic
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14740
    ^ self getBasicValuesByCounter:6 timed:true
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14741
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14742
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14743
	self current processorTimeBasic
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14744
    "
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14745
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14746
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14747
processorUsage
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
 14748
    ^ self getUsageViaPerformBlock:[self processorTime]
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
 14749
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
 14750
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14751
	self current processorUsage
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14752
    "
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14753
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14754
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14755
processorUsageFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14756
    ^ self getUsageFromLast:#processorTimeBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14757
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14758
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14759
	self current processorUsageFromLast
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14760
    "
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14761
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14762
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14763
!Win32OperatingSystem::PrinterInfo2Structure methodsFor:'accessing'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14764
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14765
defaultPriority
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14766
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14767
    |defaultPriority|
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14768
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14769
    Error handle:[:ex |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14770
	Transcript showCR: 'PrinterInfo2 error getting defaultPriority - ', ex description.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14771
	defaultPriority := 0.
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14772
    ] do:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14773
	defaultPriority := self unsignedLongAt:(60 + 1)
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14774
    ].
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14775
    ^ defaultPriority
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14776
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14777
    "Created: / 01-08-2006 / 12:46:50 / fm"
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14778
    "Modified: / 16-04-2007 / 13:08:33 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14779
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14780
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14781
pComment
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14782
    |pComment|
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14783
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14784
    Error handle:[:ex |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14785
	Transcript showCR: 'PrinterInfo2 error getting pComment - ', ex description.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14786
	pComment := 0.
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14787
    ] do:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14788
	pComment := self unsignedLongAt:(20 + 1).
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14789
    ].
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14790
10627
bef737d1b8a7 care for -1 fd returned by CreatePipe
Claus Gittinger <cg@exept.de>
parents: 10622
diff changeset
 14791
    ^ pComment == 0
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14792
	ifTrue:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14793
	ifFalse:[ (ExternalBytes address:pComment) stringAt:1 ]
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14794
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14795
    "Created: / 01-08-2006 / 14:02:55 / fm"
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14796
    "Modified: / 16-04-2007 / 13:08:39 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14797
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14798
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14799
pDriverName
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14800
    |pName|
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14801
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14802
    Error handle:[:ex |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14803
	Transcript showCR: 'PrinterInfo2 error getting pDriverName - ', ex description.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14804
	pName := 0.
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14805
    ] do:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14806
	pName := self unsignedLongAt:(16 + 1).
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14807
    ].
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14808
    pName == 0 ifTrue:[^ ''].
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14809
    ^ (ExternalBytes address:pName) stringAt:1
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14810
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14811
    "Created: / 01-08-2006 / 14:05:18 / fm"
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14812
    "Modified: / 16-04-2007 / 13:08:43 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14813
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14814
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14815
pLocation
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14816
    |pLocation externalBytes|
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14817
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14818
    Error handle:[:ex |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14819
	Transcript showCR: 'PrinterInfo2 error getting pLocation - ', ex description.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14820
	pLocation := 0.
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14821
    ] do:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14822
	pLocation := self unsignedLongAt:(24 + 1).
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14823
    ].
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14824
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14825
    pLocation == 0 ifTrue:[^ nil].
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14826
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14827
    externalBytes := ExternalBytes address:pLocation.
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 14828
    ^ externalBytes isEmpty
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14829
	ifTrue:[ nil ]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14830
	ifFalse:[ externalBytes stringAt:1 ]
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14831
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14832
    "Created: / 01-08-2006 / 14:03:21 / fm"
10098
7cb05f4cac0b *** empty log message ***
fm
parents: 10026
diff changeset
 14833
    "Modified: / 18-10-2006 / 12:06:45 / User"
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14834
    "Modified: / 16-04-2007 / 13:08:27 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14835
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14836
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14837
priority
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14838
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14839
    |priority|
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14840
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14841
    Error handle:[:ex |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14842
	Transcript showCR: 'PrinterInfo2 error getting priority - ', ex description.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14843
	priority := 0.
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14844
    ] do:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14845
	priority := self unsignedLongAt: 56 + 1
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14846
    ].
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14847
    ^ priority
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14848
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14849
    "Created: / 01-08-2006 / 14:40:08 / fm"
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14850
    "Modified: / 16-04-2007 / 13:09:02 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14851
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14852
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14853
status
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14854
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14855
    |status|
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14856
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14857
    Error handle:[:ex |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14858
	Transcript showCR: 'PrinterInfo2 error getting status - ', ex description.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14859
	status := -1.
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14860
    ] do:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14861
	status := self unsignedLongAt: 72 + 1
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14862
    ].
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14863
    ^ status
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14864
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14865
    "Created: / 31-07-2006 / 11:08:05 / fm"
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14866
    "Modified: / 16-04-2007 / 13:08:59 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14867
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14868
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14869
!Win32OperatingSystem::RegistryEntry class methodsFor:'defaults'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14870
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14871
rootKeyNames
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14872
    "returns a collection of root keyNames"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14873
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14874
    ^ #(
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14875
	'HKEY_CLASSES_ROOT'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14876
	'HKEY_CURRENT_USER'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14877
	'HKEY_LOCAL_MACHINE'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14878
	'HKEY_USERS'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14879
	'HKEY_PERFORMANCE_DATA'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14880
	'HKEY_CURRENT_CONFIG'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14881
	'HKEY_DYN_DATA'
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14882
      )
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14883
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14884
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14885
separator
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14886
    "returns the registry-key-path separator character"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14887
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14888
    ^$\
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14889
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14890
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14891
!Win32OperatingSystem::RegistryEntry class methodsFor:'documentation'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14892
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14893
documentation
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
    Interface to a WIN32 registry.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14896
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14897
    As this is a private class, access it via
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14898
	Win32OperatingSystem registryEntry
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14899
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14900
    [author:]
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14901
	Claus Gittinger (initial version & cleanup)
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14902
"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14903
!
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
examples
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14906
"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14907
    retrieve an existing entry by key:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14908
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14909
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14910
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14911
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14912
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14913
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
    retrieve a non-existing entry by key:
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\Software\xxx'
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14920
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14921
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14922
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14923
    ask a keys value:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14924
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14925
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14926
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14927
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14928
	Transcript show:'Windows serial NR:'; showCR:(k valueNamed:'ProductId').
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14929
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14930
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14931
	Transcript showCR:(k valueNamed:'CurrentVersion').
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14932
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14933
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14934
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14935
    create a sub-key (if not already present):
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14936
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14937
	|k subKey|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14938
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14939
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14940
	subKey := k createSubKeyNamed:'RegistryDemo'
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14941
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14942
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14943
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14944
    change a keys value:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14945
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14946
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14947
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14948
	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
 14949
	k valueNamed:'FooBarBaz' put:'a foo bar baz string'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14950
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14951
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14952
    delete a value:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14953
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14954
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14955
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14956
	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
 14957
	k deleteValueNamed:'FooBarBaz'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14958
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14959
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14960
    delete a key:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14961
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14962
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14963
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14964
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14965
	k deleteSubKeyNamed:'RegistryDemo'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14966
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14967
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14968
    enumerate keys:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14969
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14970
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14971
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14972
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14973
	k subKeysDo:[:subKey |
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14974
	    Transcript showCR:subKey path
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14975
	]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14976
									[exEnd]
9156
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
    enumerate all keys (recursive):
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14979
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14980
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14981
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14982
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14983
	k allSubKeysDo:[:subKey |
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14984
	    Transcript showCR:subKey path
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14985
	]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14986
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14987
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14988
    fetch value by index:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14989
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14990
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14991
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14992
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14993
	Transcript showCR:(k valueNameAtIndex:0)
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14994
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14995
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14996
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14997
    enumerate value names:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14998
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14999
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15000
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15001
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15002
	k valueNamesDo:[:nm  |
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15003
	   Transcript showCR:nm.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15004
	]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15005
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15006
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15007
    enumerate values:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15008
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15009
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15010
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15011
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15012
	k valueNamesAndValuesDo:[:nm :val |
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15013
	    Transcript showCR:(nm , ' -> ' , val storeString).
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15014
	]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15015
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15016
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15017
    search for a value (where does NT store the domain ?):
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15018
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15019
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15020
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15021
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\System'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15022
	k subKeysDo:[:subKey |
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15023
	    subKey subKeysDo:[:subSubKey |
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15024
		|tcp params|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15025
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15026
		(subSubKey path asLowercase endsWith:'services') ifTrue:[
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15027
		    tcp := subSubKey subKeyNamed:'tcpip'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15028
		    tcp notNil ifTrue:[
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15029
			params := tcp subKeyNamed:'parameters'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15030
			params notNil ifTrue:[
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15031
			    Transcript showCR:'Domain is found in ' , params path ,
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15032
					' value: ' , (params valueNamed:'Domain').
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15033
			    params close.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15034
			].
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15035
			tcp close.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15036
		    ]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15037
		]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15038
	    ]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15039
	]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15040
									[exEnd]
14514
e45969ab90ac class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14449
diff changeset
 15041
    register an exe for shell-open:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15042
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15043
	|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
 15044
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15045
	k := Win32OperatingSystem registryEntry key:'HKEY_CURRENT_USER\Software\Classes\Applications'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15046
	stx := k createSubKeyNamed:'SmalltalkX.exe'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15047
	shell := stx createSubKeyNamed:'shell'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15048
	open := shell createSubKeyNamed:'open'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15049
	cmd := open createSubKeyNamed:'command'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15050
	cmd defaultValue:(Character doubleQuote asString,OperatingSystem nameOfSTXExecutable,Character doubleQuote,
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15051
			 ' ',Character doubleQuote,'%1',Character doubleQuote).
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15052
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15053
	k := Win32OperatingSystem registryEntry key:'HKEY_CURRENT_USER\Software\Classes'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15054
	st_af := k createSubKeyNamed:'st_auto_file'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15055
	shell := st_af createSubKeyNamed:'shell'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15056
	open := shell createSubKeyNamed:'open'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15057
	cmd := open createSubKeyNamed:'command'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15058
	cmd defaultValue:(Character doubleQuote asString,OperatingSystem nameOfSTXExecutable,Character doubleQuote,
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15059
			 ' --open ',Character doubleQuote,'%1',Character doubleQuote).
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15060
	edit := shell createSubKeyNamed:'edit'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15061
	cmd := edit createSubKeyNamed:'command'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15062
	cmd defaultValue:(Character doubleQuote asString,OperatingSystem nameOfSTXExecutable,Character doubleQuote,
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15063
			 ' --edit ',Character doubleQuote,'%1',Character doubleQuote).
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15064
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15065
	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
 15066
	st := k createSubKeyNamed:'.st'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15067
	owl := st createSubKeyNamed:'OpenWithList'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15068
	list := owl valueNames.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15069
	(list contains:[:k | (owl valueNamed:k) = 'SmalltalkX.exe']) ifTrue:[
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15070
	    Transcript showCR:'already registered.'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15071
	] ifFalse:[
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15072
	    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
 15073
	    owl valueNamed:id asString put:'SmalltalkX.exe'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15074
	]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15075
									[exEnd]
14514
e45969ab90ac class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14449
diff changeset
 15076
e45969ab90ac class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14449
diff changeset
 15077
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15078
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15079
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15080
"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15081
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15082
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15083
!Win32OperatingSystem::RegistryEntry class methodsFor:'initialization'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15084
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15085
initialize
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15086
    Lobby := Registry new.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15087
    ObjectMemory addDependent:self.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15088
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15089
    HKEY_CLASSES_ROOT     := %{ __MKEXTERNALADDRESS(HKEY_CLASSES_ROOT) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15090
    HKEY_CURRENT_USER     := %{ __MKEXTERNALADDRESS(HKEY_CURRENT_USER) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15091
    HKEY_LOCAL_MACHINE    := %{ __MKEXTERNALADDRESS(HKEY_LOCAL_MACHINE) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15092
    HKEY_USERS            := %{ __MKEXTERNALADDRESS(HKEY_USERS) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15093
    HKEY_PERFORMANCE_DATA := %{ __MKEXTERNALADDRESS(HKEY_PERFORMANCE_DATA) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15094
    HKEY_CURRENT_CONFIG   := %{ __MKEXTERNALADDRESS(HKEY_CURRENT_CONFIG) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15095
    HKEY_DYN_DATA         := %{ __MKEXTERNALADDRESS(HKEY_DYN_DATA) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15096
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15097
%{
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15098
#ifndef HKEY_PERFORMANCE_TEXT
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15099
    /* sigh - not defined with borland-cc */
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15100
# define HKEY_PERFORMANCE_TEXT  (( HKEY ) (ULONG_PTR)((LONG)0x80000050) )
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15101
#endif
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15102
#ifndef HKEY_PERFORMANCE_NLSTEXT
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15103
    /* sigh - not defined with borland-cc */
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15104
# define HKEY_PERFORMANCE_NLSTEXT  (( HKEY ) (ULONG_PTR)((LONG)0x80000060) )
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15105
#endif
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15106
%}.
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15107
    HKEY_PERFORMANCE_TEXT    := %{ __MKEXTERNALADDRESS(HKEY_PERFORMANCE_TEXT) %}.
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15108
    HKEY_PERFORMANCE_NLSTEXT := %{ __MKEXTERNALADDRESS(HKEY_PERFORMANCE_NLSTEXT) %}.
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15109
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15110
    "
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15111
     self initialize
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15112
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15113
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15114
    "Created: / 19.5.1999 / 21:39:57 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15115
    "Modified: / 19.5.1999 / 22:45:31 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15116
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15117
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15118
rootKeyValueFor:specialKeyStringOrSymbol
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15119
    "returns one of the root keys or nil
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15120
     (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
 15121
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15122
    HKEY_CLASSES_ROOT isNil ifTrue:[self initialize].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15123
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15124
    specialKeyStringOrSymbol = #'HKEY_CLASSES_ROOT' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15125
	^ HKEY_CLASSES_ROOT.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15126
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15127
    specialKeyStringOrSymbol = #'HKEY_CURRENT_USER' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15128
	^ HKEY_CURRENT_USER.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15129
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15130
    specialKeyStringOrSymbol = #'HKEY_LOCAL_MACHINE' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15131
	^ HKEY_LOCAL_MACHINE.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15132
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15133
    specialKeyStringOrSymbol = #'HKEY_USERS' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15134
	^ HKEY_USERS.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15135
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15136
    specialKeyStringOrSymbol = #'HKEY_PERFORMANCE_DATA' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15137
	^ HKEY_PERFORMANCE_DATA.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15138
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15139
    specialKeyStringOrSymbol = #'HKEY_CURRENT_CONFIG' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15140
	^ HKEY_CURRENT_CONFIG.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15141
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15142
    specialKeyStringOrSymbol = #'HKEY_DYN_DATA' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15143
	^ HKEY_DYN_DATA.
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15144
    ].
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15145
    specialKeyStringOrSymbol = #'HKEY_PERFORMANCE_TEXT' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15146
	^ HKEY_PERFORMANCE_TEXT.
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15147
    ].
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15148
    specialKeyStringOrSymbol = #'HKEY_PERFORMANCE_NLSTEXT' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15149
	^ HKEY_PERFORMANCE_NLSTEXT.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15150
    ].
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
    ^ nil
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15153
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15154
    "Created: / 19.5.1999 / 21:40:30 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15155
    "Modified: / 24.12.1999 / 00:02:06 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15156
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15157
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15158
update:something with:aParameter from:changedObject
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15159
    "handle image restarts and refetch registry handles"
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
    (something == #returnFromSnapshot) ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15162
	self initialize
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15163
    ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15164
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15165
    "Created: 15.6.1996 / 15:14:03 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15166
    "Modified: 24.2.1997 / 22:08:05 / cg"
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
!Win32OperatingSystem::RegistryEntry class methodsFor:'instance creation'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15170
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15171
immediateHandle:aHandleValue
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15172
    |h newEntry|
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15173
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15174
    aHandleValue isInteger ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15175
	h := ExternalAddress newAddress:aHandleValue
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15176
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15177
	h := aHandleValue
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15178
    ].
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15179
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15180
    "/ rootKeys are not registered for RegClose ...
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15181
    newEntry := self basicNew setHandle:h path:nil.
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15182
    newEntry registerForFinalization.
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15183
    ^ newEntry.
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15184
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15185
    "
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15186
     RegistryEntry immediateHandle:16r80000002
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15187
    "
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15188
!
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15189
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15190
key:aKeyNamePath
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15191
    "retrieve an entry by full path name (starting at a root)"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15192
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15193
    ^ self key:aKeyNamePath flags:nil createIfAbsent:false
13224
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15194
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15195
    "
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15196
     self key:'HKEY_LOCAL_MACHINE'
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15197
     self key:'HKEY_LOCAL_MACHINE\Software'
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15198
     self key:'HKEY_LOCAL_MACHINE\Software\Borland\'
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15199
     self key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\3.2.5\Directory'
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15200
     (self key:'HKEY_CLASSES_ROOT\MicrosoftWorks.WordProcessor\CLSID') valueNamed:''
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15201
    "
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15202
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15203
    "Modified: / 19-01-2011 / 15:59:36 / cg"
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15204
!
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15205
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15206
key:aKeyNamePath createIfAbsent:createIfAbsent
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15207
    "retrieve an entry by full path name (starting at a root)"
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15208
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15209
    ^ self key:aKeyNamePath flags:nil createIfAbsent:createIfAbsent
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15210
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15211
    "
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15212
     self key:'HKEY_LOCAL_MACHINE'
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15213
     self key:'HKEY_LOCAL_MACHINE\Software'
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15214
     self key:'HKEY_LOCAL_MACHINE\Software\Borland\'
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15215
     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
 15216
     (self key:'HKEY_CLASSES_ROOT\MicrosoftWorks.WordProcessor\CLSID') valueNamed:''
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15217
    "
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15218
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15219
    "Created: / 19-01-2011 / 15:59:21 / cg"
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15220
!
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15221
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15222
key:aKeyNamePath flags:flags
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15223
    "retrieve an entry by full path name (starting at a root).
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15224
     flags may be one of:
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15225
	#KEY_WOW64_64KEY to force access to the 64Bit Windows key,
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15226
	#KEY_WOW64_32KEY to force access to the 32Bit Windows key,
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15227
	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
 15228
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15229
    ^ self key:aKeyNamePath flags:flags createIfAbsent:false
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15230
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15231
    "
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15232
     self key:'HKEY_LOCAL_MACHINE'
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15233
     self key:'HKEY_LOCAL_MACHINE\Software'
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15234
     self key:'HKEY_LOCAL_MACHINE\Software\Borland\'
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15235
     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
 15236
     (self key:'HKEY_CURRENT_USER\Console' flags:#KEY_WOW64_64KEY) subKeys
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15237
     (self key:'HKEY_CURRENT_USER\Console' flags:#KEY_WOW64_32KEY) subKeys
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15238
    "
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15239
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15240
    "Modified: / 19-01-2011 / 15:59:36 / cg"
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15241
!
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15242
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15243
key:aKeyNamePath flags:flags createIfAbsent:createIfAbsent
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15244
    "retrieve an entry by full path name (starting at a root).
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15245
     flags may be one of:
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15246
	#KEY_WOW64_64KEY to force access to the 64Bit Windows key,
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15247
	#KEY_WOW64_32KEY to force access to the 32Bit Windows key,
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15248
	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
 15249
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15250
    |idx first rest root|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15251
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15252
    HKEY_CLASSES_ROOT isNil ifTrue:[self initialize].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15253
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15254
    idx := aKeyNamePath indexOf:(self separator).
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15255
    idx == 0 ifTrue:[
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15256
	first := aKeyNamePath.
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15257
	rest := nil.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15258
    ] ifFalse:[
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15259
	first := aKeyNamePath copyTo:idx-1.
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15260
	rest := aKeyNamePath copyFrom:idx+1
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15261
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15262
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15263
    first := first asUppercase.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15264
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15265
    "/ the first is a pseudo name
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15266
    root := self rootKey:first.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15267
    root isNil ifTrue:[
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15268
	^ nil
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15269
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15270
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15271
    rest size == 0 ifTrue:[
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15272
	^ root
10758
36af354a5b4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10757
diff changeset
 15273
    ].
36af354a5b4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10757
diff changeset
 15274
36af354a5b4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10757
diff changeset
 15275
    Error handle:[:ex |
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15276
	^ nil
10758
36af354a5b4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10757
diff changeset
 15277
    ] do:[
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15278
	^ root subKeyNamed:rest flags:flags createIfAbsent:createIfAbsent.
10758
36af354a5b4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10757
diff changeset
 15279
    ].
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15280
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15281
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15282
     self key:'HKEY_LOCAL_MACHINE'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15283
     self key:'HKEY_LOCAL_MACHINE\Software'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15284
     self key:'HKEY_LOCAL_MACHINE\Software\Borland\'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15285
     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
 15286
     (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
 15287
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15288
13224
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15289
    "Created: / 19-01-2011 / 15:59:21 / cg"
9156
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
rootKey:aRootKeyStringOrSymbol
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15293
    "retrieve one of the root entries by name"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15294
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15295
    |keyVal|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15296
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15297
    keyVal := self rootKeyValueFor:aRootKeyStringOrSymbol.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15298
    keyVal isNil ifTrue:[^ nil].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15299
    "/ rootKeys are not registered for RegClose ...
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15300
    ^ self basicNew setHandle:keyVal path:aRootKeyStringOrSymbol.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15301
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15302
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15303
     RegistryEntry rootKey:#'HKEY_LOCAL_MACHINE'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15304
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15305
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15306
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15307
!Win32OperatingSystem::RegistryEntry class methodsFor:'misc queries'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15308
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15309
classIDOf:applicationName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15310
    |k clsIDString|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15311
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15312
    k := self key:'HKEY_CLASSES_ROOT\',applicationName,'\CLSID'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15313
    k isNil ifTrue:[ ^ nil ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15314
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15315
    clsIDString := k defaultValue.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15316
    k close.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15317
    ^ UUID fromString:clsIDString
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15318
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15319
    "
9170
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
 15320
     self classIDOf:'MicrosoftWorks.WordProcessor'
9167
aaf9ce008153 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9166
diff changeset
 15321
     self classIDOf:'AcroPDF.PDF'
aaf9ce008153 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9166
diff changeset
 15322
     self classIDOf:'PDF.PdfCtrl.5'
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15323
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15324
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15325
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15326
commandTemplateToOpenMimeType:mimeType
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15327
    "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
 15328
     Return nil, if no such application is known.
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15329
     Do nor use directly - this is a helper for MIMEType"
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15330
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15331
    ^ self commandTemplateToOpenSuffix:(self extensionForMimeType:mimeType)
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15332
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15333
    "
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15334
     Win32OperatingSystem::RegistryEntry commandTemplateToOpenMimeType:'application/pdf'
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15335
     Win32OperatingSystem::RegistryEntry commandTemplateToOpenMimeType:'audio/mp3'
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15336
     Win32OperatingSystem::RegistryEntry commandTemplateToOpenMimeType:'video/avi'
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15337
     Win32OperatingSystem::RegistryEntry commandTemplateToOpenMimeType:'application/x-zip-compressed'
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15338
    "
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15339
!
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15340
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15341
commandTemplateToOpenSuffix:suffixArg
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15342
    "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
 15343
     Do nor use directly - this is a helper for MIMEType"
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15344
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15345
    ^ self shellCommandTemplateFor:'open' onSuffix:suffixArg
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15346
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15347
    "
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15348
     self commandTemplateToOpenSuffix:'pdf'
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15349
     self commandTemplateToOpenSuffix:'zip'
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15350
    "
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15351
!
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15352
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15353
commandTemplateToPrintMimeType:mimeType
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15354
    "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
 15355
     Return nil, if no such application is known.
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15356
     Do nor use directly - this is a helper for MIMEType"
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15357
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15358
    ^ self commandTemplateToPrintSuffix:(self extensionForMimeType:mimeType)
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15359
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15360
    "
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 15361
     Win32OperatingSystem::RegistryEntry commandTemplateToPrintMimeType:'application/pdf'
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 15362
     Win32OperatingSystem::RegistryEntry commandTemplateToPrintMimeType:'audio/mp3'
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15363
    "
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15364
!
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15365
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15366
commandTemplateToPrintSuffix:suffixArg
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15367
    "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
 15368
     Do nor use directly - this is a helper for MIMEType"
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15369
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15370
    ^ self shellCommandTemplateFor:'print' onSuffix:suffixArg
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15371
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15372
    "
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 15373
     self commandTemplateToPrintSuffix:'pdf'
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 15374
     self commandTemplateToPrintSuffix:'zip'
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15375
    "
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15376
!
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15377
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15378
executableForMimeType:mimeType
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15379
    "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
 15380
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15381
    <resource: #obsolete>
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15382
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15383
    self obsoleteMethodWarning:'use commandTemplateToOpenMimeType:'.
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15384
    ^ self commandTemplateToOpenMimeType:mimeType
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15385
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15386
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15387
     Win32OperatingSystem::RegistryEntry executableForMimeType:'application/pdf'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15388
     Win32OperatingSystem::RegistryEntry executableForMimeType:'audio/mp3'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15389
     Win32OperatingSystem::RegistryEntry executableForMimeType:'video/avi'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15390
     Win32OperatingSystem::RegistryEntry executableForMimeType:'application/x-zip-compressed'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15391
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15392
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15393
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15394
executableForSuffix:suffixArg
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15395
    "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
 15396
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15397
    <resource: #obsolete>
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15398
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15399
    self obsoleteMethodWarning:'use commandTemplateToOpenSuffix:'.
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15400
    ^ self commandTemplateToOpenSuffix:suffixArg.
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15401
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15402
    "
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 15403
     self executableForSuffix:'pdf'
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15404
     self executableForSuffix:'zip'
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15405
    "
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15406
!
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15407
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15408
extensionForMimeType:mimeType
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15409
    "HELPER: given a mimeType, retrieve the file extension or nil (if unknown)"
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15410
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15411
    |k suffix|
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15412
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15413
    k := self key:'HKEY_CLASSES_ROOT\MIME\Database\Content Type\',mimeType.
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15414
    k notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15415
	suffix := k valueNamed:'extension'.
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15416
    ].
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15417
    ^ suffix
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15418
!
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15419
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15420
shellCommandTemplateFor:operation onSuffix:suffixArg
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15421
    "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
 15422
9257
e0554fbd09d3 added redirect for RegistryEntry
sr
parents: 9255
diff changeset
 15423
    |k fkey cmd suffix redirect|
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15424
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15425
    suffix := suffixArg.
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15426
    suffix isNil ifTrue:[^ nil].
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 15427
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15428
    (suffix startsWith:'.') ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15429
	suffix := suffix copyFrom:2
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15430
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15431
    k := self key:'HKEY_CLASSES_ROOT\.',suffix.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15432
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15433
    k notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15434
	fkey := (k valueNamed:'').
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15435
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15436
    fkey isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15437
	fkey := suffix,'_auto_file'
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15438
    ].
9257
e0554fbd09d3 added redirect for RegistryEntry
sr
parents: 9255
diff changeset
 15439
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15440
    fkey notEmptyOrNil ifTrue:[
9257
e0554fbd09d3 added redirect for RegistryEntry
sr
parents: 9255
diff changeset
 15441
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15442
	redirect := nil.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15443
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15444
	k := Win32OperatingSystem::RegistryEntry key:('HKEY_CLASSES_ROOT\' , fkey , '\CurVer').
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15445
	k notNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15446
	    redirect := k defaultValue
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15447
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15448
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15449
	redirect isNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15450
	     k := Win32OperatingSystem::RegistryEntry key:('HKEY_CLASSES_ROOT\' , (fkey) , '\shell\',operation,'\command').
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15451
	] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15452
	     k := Win32OperatingSystem::RegistryEntry key:('HKEY_CLASSES_ROOT\' , (redirect) , '\shell\',operation,'\command').
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15453
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15454
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15455
	k notNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15456
	    cmd := k defaultValue
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15457
	].
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 15458
    ].
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 15459
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 15460
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 15461
    ^ cmd
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15462
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15463
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15464
!Win32OperatingSystem::RegistryEntry class methodsFor:'registry access'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15465
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15466
stringValueFor:valueName atKey:keyPath
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15467
    "convenient accessing method;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15468
     Looks for a string value under keyPath;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15469
     returns nil if either not found, or no string value"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15470
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15471
    |k v|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15472
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15473
    k := self key:keyPath.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15474
    k isNil ifTrue:[^ nil].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15475
    v := k valueNamed:valueName.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15476
    k close.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15477
    v isString ifFalse:[^ nil].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15478
    ^ v
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15479
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15480
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15481
     self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15482
	stringValueFor:'Content Type'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15483
	atKey:'HKEY_CLASSES_ROOT\.au'
9155
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 15484
    "
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 15485
! !
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 15486
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15487
!Win32OperatingSystem::RegistryEntry methodsFor:'accessing'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15488
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15489
handleValue
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15490
    ^ handle address
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15491
!
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15492
17619
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 15493
isNew
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 15494
    "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
 15495
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 15496
    ^ isNew ? false
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 15497
!
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 15498
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15499
name
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15500
    "return the keys name component (subKey name within my
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15501
     parent key)"
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
    |idx|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15504
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15505
    idx := path lastIndexOf:(self class separator).
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15506
    idx == 0 ifTrue:[^ path].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15507
    ^ path copyFrom:idx+1
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15508
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15509
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15510
path
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15511
    "return the keys full key path name"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15512
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15513
    ^ path.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15514
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15515
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15516
!Win32OperatingSystem::RegistryEntry methodsFor:'accessing subkeys'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15517
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15518
createSubKeyNamed:subKeyString
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15519
    "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
 15520
     If it already exists, return it.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15521
     Return nil if the new key cannot be created."
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15522
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15523
    ^ self subKeyNamed:subKeyString flags:nil createIfAbsent:true
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15524
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15525
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15526
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15527
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15528
     top := self key:'HKEY_CURRENT_USER'.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15529
     sub := top createSubKeyNamed:'FooBarBaz'.
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
!
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
createSubKeyNamed:subKeyString flags:flags
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15534
    "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
 15535
     If it already exists, return it.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15536
     Return nil if the new key cannot be created.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15537
     flags may be one of:
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15538
	#KEY_WOW64_64KEY to force access to the 64Bit Windows key,
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15539
	#KEY_WOW64_32KEY to force access to the 32Bit Windows key,
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15540
	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
 15541
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15542
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15543
    ^ self subKeyNamed:subKeyString flags:flags createIfAbsent:true
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15544
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15545
    "
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15546
     |top sub|
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15547
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15548
     top := self key:'HKEY_CURRENT_USER'.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15549
     sub := top createSubKeyNamed:'FooBarBaz' flags:nil.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15550
    "
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15551
!
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15552
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15553
deleteSubKeyNamed:subKeyString
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15554
    "delete a key below mySelf.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15555
     Return true on success."
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15556
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15557
    ^ self deleteSubKeyNamed:subKeyString flags:nil
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15558
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15559
    "
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15560
     |top sub|
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15561
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15562
     top := self key:'HKEY_CURRENT_USER'.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15563
     sub := top createSubKeyNamed:'FooBarBaz'.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15564
     top deleteSubKeyNamed:'FooBarBaz'.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15565
    "
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15566
!
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15567
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15568
deleteSubKeyNamed:subKeyString flags:flags
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15569
    "delete a key below mySelf.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15570
     Return true on success.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15571
     flags may be one of:
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15572
	#KEY_WOW64_64KEY to force access to the 64Bit Windows key,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15573
	#KEY_WOW64_32KEY to force access to the 32Bit Windows key,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15574
	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
 15575
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15576
     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
 15577
	     the flags are currently ignored"
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15578
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15579
    |subKeyStringZ errorNumber|
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15580
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15581
    subKeyStringZ := subKeyString asUnicode16StringZ.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15582
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15583
%{
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15584
#ifndef KEY_WOW64_64KEY
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15585
// this is missing in BCC header files
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15586
# define KEY_WOW64_64KEY    0x0100
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15587
# define KEY_WOW64_32KEY    0x0200
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15588
#endif
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15589
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15590
    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
 15591
    int _retVal;
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15592
    int _flags = 0;
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15593
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15594
    if (flags != nil) {
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15595
	if (flags == @symbol(KEY_WOW64_64KEY)) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15596
	    _flags = KEY_WOW64_64KEY;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15597
	} else if (flags == @symbol(KEY_WOW64_32KEY)) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15598
	    _flags = KEY_WOW64_32KEY;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15599
	} else {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15600
	    errorNumber = @symbol(badArgument2);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15601
	    goto out;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15602
	}
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15603
    }
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15604
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15605
    if (__isExternalAddressLike(__INST(handle))
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15606
     && __isUnicode16String(subKeyStringZ)) {
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15607
	myKey = (HKEY)__externalAddressVal(__INST(handle));
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15608
#ifdef __BORLANDC__
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15609
	_retVal = RegDeleteKeyW(myKey, __unicode16StringVal(subKeyStringZ));
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15610
#else
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15611
	_retVal = RegDeleteKeyExW(myKey,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15612
		    __unicode16StringVal(subKeyStringZ),
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15613
		    _flags,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15614
		    0); // reserved
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15615
#endif
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15616
	if (_retVal == ERROR_SUCCESS) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15617
	    RETURN (true);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15618
	}
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15619
	if ((_retVal != ERROR_PATH_NOT_FOUND)
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15620
	 && (_retVal != ERROR_FILE_NOT_FOUND)) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15621
	    errorNumber = __MKSMALLINT(_retVal);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15622
	}
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15623
    }
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15624
out:;
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15625
%}.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15626
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15627
    errorNumber notNil ifTrue:[
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15628
	(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
 15629
    ].
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15630
    ^ false
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
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15633
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15634
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15635
     top := self key:'HKEY_CURRENT_USER'.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15636
     sub := top createSubKeyNamed:'FooBarBaz'.
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15637
     top deleteSubKeyNamed:'FooBarBaz' flags:nil.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15638
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15639
!
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
remoteKeyOnHost:hostName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15642
    "return the corresponding registry entry from
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15643
     a remote computers registry."
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15644
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15645
    |newEntry remoteHandle errorNumber|
9156
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
    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
 15649
    int _retVal;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15650
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
 15651
    if (__isExternalAddressLike(__INST(handle)) && __isStringLike(hostName)) {
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15652
	myKey = (HKEY)__externalAddressVal(__INST(handle));
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15653
	if ((_retVal = RegConnectRegistryA(__stringVal(hostName), myKey, &remoteKey)) == ERROR_SUCCESS) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15654
	    remoteHandle = __MKEXTERNALADDRESS(remoteKey);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15655
	} else {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15656
	    if ((_retVal != ERROR_PATH_NOT_FOUND)
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15657
	     && (_retVal != ERROR_FILE_NOT_FOUND)) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15658
		errorNumber = __MKSMALLINT(_retVal);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15659
	    }
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15660
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15661
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15662
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15663
    remoteHandle notNil ifTrue:[
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15664
	newEntry := self class basicNew setHandle:remoteHandle path:path.
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15665
	newEntry registerForFinalization.
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15666
	^ newEntry.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15667
    ].
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15668
    errorNumber notNil ifTrue:[
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15669
	(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
 15670
    ].
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15671
    ^ nil
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15672
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15673
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15674
     |top remote|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15675
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15676
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15677
     remote := top remoteKeyOnHost:'BETTI'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15678
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15679
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15680
     |top remote|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15681
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15682
     top := self key:'HKEY_USERS'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15683
     remote := top remoteKeyOnHost:'BETTI'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15684
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15685
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15686
     |top remote|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15687
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15688
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15689
     remote := top remoteKeyOnHost:'JOSHUA'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15690
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15691
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15692
     |top remote|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15693
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15694
     top := self key:'HKEY_USERS'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15695
     remote := top remoteKeyOnHost:'JOSHUA'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15696
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15697
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15698
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15699
subKeyAtIndex:subKeyIndex
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15700
    "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
 15701
     Return nil if no such key exists"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15702
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15703
    |subKeyName subKeyClassName errorNumber|
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15704
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15705
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15706
    HKEY myKey, subKey = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15707
    char nameBuffer[256];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15708
    DWORD nameSize = sizeof(nameBuffer) - 1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15709
    char classNameBuffer[256];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15710
    DWORD classNameSize = sizeof(classNameBuffer) - 1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15711
    FILETIME modificationTime;
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15712
    int _retVal;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15713
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15714
    if (__isExternalAddressLike(__INST(handle))
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15715
     && __isSmallInteger(subKeyIndex)) {
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15716
	myKey = (HKEY)__externalAddressVal(__INST(handle));
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15717
	if ((_retVal = RegEnumKeyExA(myKey, __intVal(subKeyIndex),
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15718
			 nameBuffer, &nameSize,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15719
			 NULL,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15720
			 classNameBuffer, &classNameSize,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15721
			 &modificationTime)) == ERROR_SUCCESS) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15722
	    nameBuffer[nameSize] = '\0';
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15723
	    classNameBuffer[classNameSize] = '\0';
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15724
	    subKeyName = __MKSTRING(nameBuffer);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15725
	    subKeyClassName = __MKSTRING(classNameBuffer);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15726
	} else {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15727
	    if ((_retVal != ERROR_PATH_NOT_FOUND)
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15728
	     && (_retVal != ERROR_FILE_NOT_FOUND)
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15729
	     && (_retVal != ERROR_NO_MORE_ITEMS)) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15730
		errorNumber = __MKSMALLINT(_retVal);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15731
	    }
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15732
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15733
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15734
%}.
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15735
    subKeyName notNil ifTrue:[
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15736
	^ self subKeyNamed:subKeyName.
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15737
    ].
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15738
    errorNumber notNil ifTrue:[
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15739
	(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
 15740
    ].
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15741
    ^ nil
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15742
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15743
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15744
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15745
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15746
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15747
     sub := top subKeyAtIndex:0
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15748
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15749
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15750
19336
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15751
subKeyNameAndClassAtIndex:subKeyIndex
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15752
    "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
 15753
     Return nil if no such key exists"
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15754
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15755
    |subKeyName subKeyClassName errorNumber|
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15756
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15757
%{
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15758
    HKEY myKey, subKey = 0;
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15759
    char nameBuffer[256];
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15760
    DWORD nameSize = sizeof(nameBuffer) - 1;
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15761
    char classNameBuffer[256];
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15762
    DWORD classNameSize = sizeof(classNameBuffer) - 1;
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15763
    FILETIME modificationTime;
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15764
    int _retVal;
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15765
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15766
    if (__isExternalAddressLike(__INST(handle))
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15767
     && __isSmallInteger(subKeyIndex)) {
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15768
	myKey = (HKEY)__externalAddressVal(__INST(handle));
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15769
	if ((_retVal = RegEnumKeyExA(myKey, __intVal(subKeyIndex),
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15770
			 nameBuffer, &nameSize,
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15771
			 NULL,
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15772
			 classNameBuffer, &classNameSize,
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15773
			 &modificationTime)) == ERROR_SUCCESS) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15774
	    nameBuffer[nameSize] = '\0';
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15775
	    classNameBuffer[classNameSize] = '\0';
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15776
	    subKeyName = __MKSTRING(nameBuffer);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15777
	    subKeyClassName = __MKSTRING(classNameBuffer);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15778
	} else {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15779
	    if ((_retVal != ERROR_PATH_NOT_FOUND)
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15780
	     && (_retVal != ERROR_FILE_NOT_FOUND)
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15781
	     && (_retVal != ERROR_NO_MORE_ITEMS)) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15782
		errorNumber = __MKSMALLINT(_retVal);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15783
	    }
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15784
	}
19336
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15785
    }
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15786
%}.
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15787
    subKeyName notNil ifTrue:[
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15788
	^ {subKeyName . subKeyClassName}.
19336
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15789
    ].
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15790
    errorNumber notNil ifTrue:[
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 15791
	(OperatingSystem errorHolderForNumber:errorNumber) reportError.
19336
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15792
    ].
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15793
    ^ nil
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15794
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15795
    "
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15796
     |top sub|
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15797
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15798
     top := self key:'HKEY_LOCAL_MACHINE'.
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15799
     sub := top subKeyNameAndClassAtIndex:0
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15800
    "
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15801
!
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 15802
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15803
subKeyNamed:subKeyString
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15804
    "return a new registry entry below mySelf with the given subKey.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15805
     Return nil if no such key exists"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15806
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15807
    ^ self subKeyNamed:subKeyString flags:nil createIfAbsent:false
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15808
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15809
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15810
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15811
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15812
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15813
     sub := top subKeyNamed:'Software'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15814
    "
13224
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15815
!
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15816
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15817
subKeyNamed:subKeyString createIfAbsent:createIfAbsent
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15818
    "return a new registry entry below mySelf with the given subKey.
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15819
     If no such key exists and createIfAbsent is true, the key is created.
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15820
     Otherwise, nil is returned"
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15821
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15822
    ^ self subKeyNamed:subKeyString flags:nil createIfAbsent:createIfAbsent
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
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15825
subKeyNamed:subKeyString flags:flags
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15826
    "return a new registry entry below mySelf with the given subKey.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15827
     Return nil if no such key exists.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15828
     flags may be one of:
17601
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15829
	#KEY_WOW64_64KEY to force access to the 64Bit Windows key,
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15830
	#KEY_WOW64_32KEY to force access to the 32Bit Windows key,
f740dbc12977 Fix last change
Stefan Vogel <sv@exept.de>
parents: 17599
diff changeset
 15831
	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
 15832
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15833
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15834
    ^ self subKeyNamed:subKeyString flags:flags createIfAbsent:false
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15835
!
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15836
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15837
subKeyNamed:subKeyString flags:flags createIfAbsent:createIfAbsent
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15838
    "return a new registry entry below mySelf with the given subKey.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15839
     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
 15840
     Otherwise, nil is returned.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15841
     flags may be one of:
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15842
	#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
 15843
	#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
 15844
	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
 15845
17619
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 15846
    |subKeyStringZ newEntry subHandle errorNumber disposition|
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15847
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15848
    subKeyStringZ := subKeyString asUnicode16StringZ.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15849
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15850
%{
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15851
#ifndef KEY_WOW64_64KEY
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15852
// this is missing in BCC header files
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15853
# define KEY_WOW64_64KEY    0x0100
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15854
# define KEY_WOW64_32KEY    0x0200
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15855
#endif
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15856
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15857
    HKEY myKey, subKey = 0;
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15858
    int _retVal;
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15859
    int _flags = 0;
17619
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 15860
    int _disposition = 0;
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15861
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15862
    if (flags != nil) {
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15863
	if (flags == @symbol(KEY_WOW64_64KEY)) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15864
	    _flags = KEY_WOW64_64KEY;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15865
	} else if (flags == @symbol(KEY_WOW64_32KEY)) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15866
	    _flags = KEY_WOW64_32KEY;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15867
	} else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15868
	    errorNumber = @symbol(badArgument2);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15869
	    goto out;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15870
	}
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15871
    }
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15872
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15873
    if (__isExternalAddressLike(__INST(handle))
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15874
	&& __isUnicode16String(subKeyStringZ)) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15875
	myKey = (HKEY)__externalAddressVal(__INST(handle));
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15876
	if (createIfAbsent == true) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15877
	    _retVal = RegCreateKeyExW(myKey,
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15878
			__unicode16StringVal(subKeyStringZ),
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15879
			0,      // reserved
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15880
			NULL,   // class
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15881
			0,      // options
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15882
			KEY_ALL_ACCESS|_flags,   // rights
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15883
			NULL,   // securityAttributes - handle cannot be inherited
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15884
			&subKey,
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15885
			&_disposition);  // disposition (created vs. opened)
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15886
	    disposition = _disposition == REG_CREATED_NEW_KEY ? true : false;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15887
	} else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15888
	    _retVal = RegOpenKeyExW(myKey,
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15889
			__unicode16StringVal(subKeyStringZ),
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15890
			0,
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15891
			KEY_ALL_ACCESS|_flags,
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15892
			&subKey);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15893
	    disposition = false;
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15894
	}
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15895
	if (_retVal == ERROR_SUCCESS) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15896
	    subHandle = __MKEXTERNALADDRESS(subKey);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15897
	} else {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15898
	    if ((_retVal != ERROR_PATH_NOT_FOUND)
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15899
	     && (_retVal != ERROR_FILE_NOT_FOUND)) {
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15900
		errorNumber = __MKSMALLINT(_retVal);
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15901
	    }
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15902
	}
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15903
    }
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15904
out:;
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15905
%}.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15906
    subHandle notNil ifTrue:[
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15907
	newEntry := self class basicNew
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15908
			setHandle:subHandle
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15909
			path:((path ? '?') , self class separator asString , subKeyString)
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15910
			isNew:disposition.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15911
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15912
	newEntry registerForFinalization.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15913
	^ newEntry.
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15914
    ].
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15915
    errorNumber notNil ifTrue:[
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 15916
	(OperatingSystem errorHolderForNumber:errorNumber) reportProceedableError.
17599
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15917
    ].
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15918
    ^ nil
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15919
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15920
    "
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15921
     |top sub|
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15922
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15923
     top := self key:'HKEY_LOCAL_MACHINE'.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15924
     sub := top subKeyNamed:'Software' flags:nil createIfAbsent:false
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15925
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15926
     |top sub|
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15927
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15928
     top := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit'.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15929
     top valueNamed:'CurrentVersion'.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15930
     sub := top subKeyNamed:'1.8' flags:#KEY_WOW64_64KEY createIfAbsent:false.
db07ed37aab5 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17595
diff changeset
 15931
    "
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15932
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15933
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15934
!Win32OperatingSystem::RegistryEntry methodsFor:'accessing values'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15935
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15936
defaultValue
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15937
    ^ self valueNamed:''
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15938
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15939
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15940
     (self key:'HKEY_CLASSES_ROOT\MicrosoftWorks.WordProcessor\CLSID') defaultValue
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15941
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15942
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15943
11623
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15944
defaultValue:datum
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15945
    "store a value; the value type depends upon the stored value:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15946
	ByteArray       -> REG_BINARY
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15947
	String          -> REG_SZ
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15948
	Array of string -> REG_MULTI_SZ
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15949
	Integer         -> REG_DWORD
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15950
	nil             -> REG_NONE
11623
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15951
    "
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15952
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15953
    ^ self valueNamed:'' put:datum
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15954
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15955
    "
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15956
     (self key:'HKEY_CLASSES_ROOT\MicrosoftWorks.WordProcessor\CLSID') defaultValue
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15957
    "
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15958
!
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15959
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15960
deleteValueNamed:aValueName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15961
    "delete a value.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15962
     Return true on success."
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15963
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15964
    |errorNumber|
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15965
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15966
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15967
    HKEY myKey;
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15968
    int _retVal;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15969
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15970
    if (__isExternalAddressLike(__INST(handle))
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
 15971
     && __isStringLike(aValueName)) {
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15972
	myKey = (HKEY)__externalAddressVal(__INST(handle));
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15973
	if ((_retVal = RegDeleteValueA(myKey, __stringVal(aValueName))) == ERROR_SUCCESS) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15974
	    RETURN (true);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15975
	}
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15976
	if ((_retVal != ERROR_PATH_NOT_FOUND)
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15977
	 && (_retVal != ERROR_FILE_NOT_FOUND)) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15978
	    errorNumber = __MKSMALLINT(_retVal);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15979
	}
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15980
    }
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15981
%}.
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15982
    errorNumber notNil ifTrue:[
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 15983
	(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
 15984
    ].
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15985
    ^ false
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15986
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15987
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15988
valueNameAtIndex:valueIndex
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15989
    "return a values name for the given value index.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15990
     Return nil if no such value exists"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15991
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15992
    |valueName errorNumber|
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15993
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15994
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15995
    HKEY myKey;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15996
    char nameBuffer[256];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15997
    DWORD nameSize = sizeof(nameBuffer) - 1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15998
    DWORD valueType;
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15999
    int _retVal;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16000
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16001
    if (__isExternalAddressLike(__INST(handle))
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16002
     && __isSmallInteger(valueIndex)) {
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16003
	myKey = (HKEY)__externalAddressVal(__INST(handle));
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16004
	if ((_retVal = RegEnumValueA(myKey, __intVal(valueIndex),
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16005
			 nameBuffer, &nameSize,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16006
			 NULL,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16007
			 &valueType,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16008
			 NULL, NULL)) == ERROR_SUCCESS) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16009
	    nameBuffer[nameSize] = '\0';
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16010
	    valueName = __MKSTRING(nameBuffer);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16011
	} else {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16012
	    if ((_retVal != ERROR_PATH_NOT_FOUND)
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16013
	     && (_retVal != ERROR_FILE_NOT_FOUND)
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16014
	     && (_retVal != ERROR_NO_MORE_ITEMS)) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16015
		errorNumber = __MKSMALLINT(_retVal);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16016
	    }
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16017
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16018
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16019
%}.
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 16020
    errorNumber notNil ifTrue:[
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16021
	(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
 16022
    ].
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16023
    ^ valueName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16024
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16025
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16026
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16027
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16028
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16029
     sub := top subKeyAtIndex:0
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16030
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16031
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16032
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16033
valueNamed:aValueName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16034
    "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
 16035
	REG_BINARY      -> ByteArray
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16036
	REG_SZ          -> String
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16037
	REG_MULTI_SZ    -> Array of strings
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16038
	REG_DWORD       -> Integer
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16039
	REG_NONE        -> nil
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16040
    "
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16041
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 16042
    |stringArray retVal errorNumber|
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16043
19335
2cf2f4dbd6be #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19288
diff changeset
 16044
%{  /* STACK: 20000 */
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16045
    HKEY myKey;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16046
    DWORD valueType;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16047
    union {
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16048
	DWORD dWord;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16049
	unsigned char dWordBytes[4];
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16050
	unsigned char smallDataBuffer[1024*16];
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16051
    } quickData;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16052
    int val;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16053
    DWORD dataSize = sizeof(quickData);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16054
    unsigned char *dataBuffer = NULL;
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16055
#define xxUSE_UNICODE
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16056
#ifdef USE_UNICODE
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16057
# define xRegQueryValueEx  RegQueryValueExW
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 16058
# define CHAR             short
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16059
#else
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16060
# define RegQueryValueEx  RegQueryValueExA
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 16061
# define CHAR             char
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16062
#endif
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16063
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16064
    if (__isExternalAddressLike(__INST(handle))
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
 16065
     && __isStringLike(aValueName)) {
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16066
	int ret;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16067
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16068
	myKey = (HKEY)__externalAddressVal(__INST(handle));
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16069
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16070
	/*
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16071
	 * try to get it with one call ...
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
	ret = RegQueryValueEx(myKey, __stringVal(aValueName),
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16074
			 NULL,
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16075
			 &valueType,
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16076
			 (char *)&quickData,
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16077
			 &dataSize);
10692
043cb2920c0a *** empty log message ***
sr
parents: 10690
diff changeset
 16078
#if 0
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16079
	console_printf("dataSize=%d\n", dataSize);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16080
#endif
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16081
	while (ret == ERROR_MORE_DATA) {
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16082
#if 0
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16083
	    console_printf("ERROR_MORE_DATA dataSize=%d\n", dataSize);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16084
	    console_printf("valueType=%d\n", valueType);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16085
#endif
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16086
	    /*
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16087
	     * nope - need another one ...
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
	    if (myKey = HKEY_PERFORMANCE_DATA) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16090
		dataSize = dataSize * 2;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16091
	    }
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16092
	    switch (valueType) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16093
		case REG_BINARY:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16094
		case REG_MULTI_SZ:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16095
		    dataBuffer = malloc(dataSize);;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16096
		    break;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16097
		case REG_SZ:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16098
		    dataBuffer = malloc(dataSize);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16099
		    break;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16100
		default:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16101
		    console_printf("RegistryEntry [warning]: unhandled valueType: %d\n", valueType);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16102
		    break;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16103
	    }
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16104
	    if (dataBuffer) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16105
		ret = RegQueryValueEx(myKey, __stringVal(aValueName),
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16106
				 NULL,
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16107
				 &valueType,
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16108
				 dataBuffer,
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16109
				 &dataSize);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16110
	    } else {
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
	    if (myKey != HKEY_PERFORMANCE_DATA) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16114
		if (ret != ERROR_SUCCESS) break;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16115
	    }
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16116
	}
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
	if (ret == ERROR_SUCCESS) {
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16119
#if 0
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16120
	    console_printf("ERROR_SUCCESS dataSize=%d\n", dataSize);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16121
	    console_printf("valueType=%d\n", valueType);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16122
#endif
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16123
	    switch (valueType) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16124
		case REG_NONE:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16125
		    /* RETURN (@symbol(none));  */
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16126
		    retVal = nil;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16127
		    break;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16128
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16129
		case REG_BINARY:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16130
		    retVal = __MKBYTEARRAY(dataBuffer ? dataBuffer : quickData.smallDataBuffer, dataSize);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16131
		    break;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16132
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16133
		case REG_SZ:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16134
		case REG_EXPAND_SZ:
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16135
#ifdef USE_UNICODE
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16136
		    retVal = __MKU16STRING(dataBuffer ? dataBuffer : quickData.smallDataBuffer);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16137
#else
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16138
		    retVal = __MKSTRING(dataBuffer ? dataBuffer : quickData.smallDataBuffer);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16139
#endif
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16140
		    break;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16141
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16142
#if 0
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16143
		case REG_DWORD:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16144
		    /* int in native format */
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16145
		    retVal = __MKUINT(quickData.dWord);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16146
		    break;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16147
#endif
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16148
		case REG_DWORD_LITTLE_ENDIAN:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16149
		    val = quickData.dWordBytes[3];
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16150
		    val = (val << 8) | quickData.dWordBytes[2];
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16151
		    val = (val << 8) | quickData.dWordBytes[1];
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16152
		    val = (val << 8) | quickData.dWordBytes[0];
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16153
		    retVal = __MKUINT(val);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16154
		    break;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16155
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16156
		case REG_DWORD_BIG_ENDIAN:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16157
		    val = quickData.dWordBytes[0];
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16158
		    val = (val << 8) | quickData.dWordBytes[1];
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16159
		    val = (val << 8) | quickData.dWordBytes[2];
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16160
		    val = (val << 8) | quickData.dWordBytes[3];
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16161
		    retVal = __MKUINT(val);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16162
		    break;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16163
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16164
		case REG_MULTI_SZ:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16165
		    {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16166
			CHAR *cp, *cp0;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16167
			int ns, i;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16168
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16169
			cp0 = dataBuffer ? dataBuffer : quickData.smallDataBuffer;
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16170
#if 0
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16171
			console_printf("**************\n");
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16172
			for (i=0;i<50;i++) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16173
			  console_printf("%x ", cp0[i]);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16174
			}
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16175
			console_printf("\n");
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16176
			for (i=0;i<50;i++) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16177
			  if (cp0[i] == 0)
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16178
			    console_printf("\n");
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16179
			  else
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16180
			    console_printf("%c", cp0[i]);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16181
			}
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16182
			console_printf("\n");
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16183
			console_printf("**************\n");
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16184
#endif
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16185
			cp = cp0;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16186
			ns = 0;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16187
			while (*cp) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16188
			    while (*cp++) ;;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16189
			    ns++;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16190
			}
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16191
			stringArray = __ARRAY_NEW_INT(ns);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16192
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16193
			i = 0;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16194
			while (*cp0) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16195
			    OBJ s;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16196
			    CHAR *cp;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16197
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16198
			    cp = cp0;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16199
			    while (*cp++) ;;
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16200
#ifdef USE_UNICODE
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16201
			    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
 16202
#else
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16203
			    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
 16204
#endif
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16205
			    cp0 = cp;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16206
			    i++;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16207
			}
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16208
			retVal = stringArray;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16209
			break;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16210
		    }
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16211
		default:
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16212
		    console_printf("RegistryEntry [warning]: unhandled valueType: %d\n", valueType);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16213
		    break;
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16214
	    }
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16215
	} else {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16216
	    if ((ret != ERROR_PATH_NOT_FOUND)
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16217
	     && (ret != ERROR_FILE_NOT_FOUND)) {
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16218
		errorNumber = __MKSMALLINT(ret);
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16219
	    }
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16220
	}
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16221
    }
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16222
    if (dataBuffer) free(dataBuffer);
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16223
%}.
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 16224
    errorNumber notNil ifTrue:[
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16225
	(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
 16226
    ].
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 16227
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 16228
    ^ retVal
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16229
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16230
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16231
     |key|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16232
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16233
     key := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16234
     key valueNamed:'CurrentVersion'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16235
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16236
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16237
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16238
valueNamed:aValueName put:datum
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16239
    "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
 16240
	ByteArray       -> REG_BINARY
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16241
	String          -> REG_SZ
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16242
	Array of string -> REG_MULTI_SZ
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16243
	Integer         -> REG_DWORD
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16244
	nil             -> REG_NONE
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
    |data stringArray errorNumber|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16248
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16249
    HKEY myKey;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16250
    DWORD valueType = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16251
    int val;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16252
    DWORD dataSize = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16253
    unsigned char *dataPointer = NULL;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16254
    int datumOk = 1, mustFreeData = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16255
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 16256
    if (__isExternalAddressLike(__INST(handle))
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
 16257
     && __isStringLike(aValueName)) {
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16258
	int ret;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16259
	OBJ cls;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16260
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16261
	myKey = (HKEY)__externalAddressVal(__INST(handle));
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16262
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16263
	if (datum == nil) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16264
	    valueType = REG_NONE;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16265
	    dataSize = 0;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16266
	} else if (__isSmallInteger(datum)) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16267
	    valueType = REG_DWORD;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16268
	    val = __intVal(datum);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16269
	    dataPointer = (unsigned char *)(&val);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16270
	    dataSize = sizeof(val);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16271
	} else if (__isStringLike(datum)) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16272
	    valueType = REG_SZ;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16273
	    dataPointer = __stringVal(datum);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16274
	    dataSize = __stringSize(datum) + 1;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16275
	} else if (__Class(datum) == ByteArray) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16276
	    valueType = REG_BINARY;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16277
	    dataPointer = __ByteArrayInstPtr(datum)->ba_element;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16278
	    dataSize = __byteArraySize(datum);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16279
	} else if (__Class(datum) == LargeInteger) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16280
	    valueType = REG_DWORD;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16281
	    val = __longIntVal(datum);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16282
	    if (val) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16283
		dataPointer = (unsigned char *)(&val);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16284
		dataSize = sizeof(val);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16285
	    } else {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16286
		datumOk = 0;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16287
	    }
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16288
	} else if (__Class(datum) == Array) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16289
	    int i = 0, ns = 0, totalSize = 0;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16290
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16291
	    valueType = REG_MULTI_SZ;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16292
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16293
	    /*
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16294
	     * must allocate a local buffer
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16295
	     * find size ...
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16296
	     */
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16297
	    for (i=0; i<__arraySize(datum); i++) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16298
		OBJ s = __ArrayInstPtr(datum)->a_element[i];
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16299
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16300
		if (__isStringLike(s)) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16301
		    totalSize += __stringSize(s) + 1;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16302
		} else {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16303
		    datumOk = 0;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16304
		    break;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16305
		}
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16306
		ns++;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16307
	    }
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16308
	    if (datumOk) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16309
		char *cp;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16310
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16311
		/*
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16312
		 * allocate and fill...
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16313
		 */
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16314
		totalSize ++;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16315
		dataPointer = (char *)(malloc(totalSize));
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16316
		mustFreeData = 1;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16317
		cp = dataPointer;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16318
		for (i=0; i<__arraySize(datum); i++) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16319
		    OBJ s = __ArrayInstPtr(datum)->a_element[i];
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16320
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16321
		    strcpy(cp, __stringVal(s));
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16322
		    cp += __stringSize(s);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16323
		    *cp++ = '\0';
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16324
		}
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16325
		*cp++ = '\0';
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16326
		dataSize = totalSize;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16327
	    }
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16328
	} else {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16329
	    datumOk = 0;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16330
	}
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16331
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16332
	if (datumOk) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16333
	    ret = RegSetValueExA(myKey, __stringVal(aValueName),
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16334
				0, valueType,
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16335
				dataPointer, dataSize);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16336
	    if (mustFreeData) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16337
		free(dataPointer);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16338
	    }
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16339
	    if (ret == ERROR_SUCCESS) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16340
		RETURN (true);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16341
	    }
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16342
	    if ((ret != ERROR_PATH_NOT_FOUND)
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16343
	     && (ret != ERROR_FILE_NOT_FOUND)) {
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16344
		errorNumber = __MKSMALLINT(ret);
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16345
	    }
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16346
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16347
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16348
%}.
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 16349
    errorNumber notNil ifTrue:[
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16350
	(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
 16351
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16352
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16353
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16354
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16355
     |key|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16356
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16357
     key := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16358
     key valueNamed:'CurrentVersion' put:'3.5.2'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16359
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16360
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16361
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16362
!Win32OperatingSystem::RegistryEntry methodsFor:'enumeration'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16363
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16364
allSubKeysDo:aBlock
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16365
    "recursively evaluate aBlock for all subKeys below the receiver"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16366
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16367
    |idx subEntry|
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
    idx := 0.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16370
    [true] whileTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16371
	subEntry := self subKeyAtIndex:idx.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16372
	subEntry isNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16373
	    ^self
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16374
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16375
	aBlock value:subEntry.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16376
	subEntry allSubKeysDo:aBlock.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16377
	subEntry close.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16378
	idx := idx + 1.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16379
    ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16380
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16381
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16382
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16383
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16384
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16385
     top allSubKeysDo:[:subEntry |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16386
	Transcript showCR:subEntry path
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
19336
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16391
subKeyNamesAndClassesDo:aTwoArgBlock
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16392
    "evaluate aBlock for all subKeys names and class names below the receiver"
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16393
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16394
    |idx nameAndClassNameOrNil|
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16395
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16396
    idx := 0.
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16397
    [true] whileTrue:[
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16398
	nameAndClassNameOrNil := self subKeyNameAndClassAtIndex:idx.
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16399
	nameAndClassNameOrNil isNil ifTrue:[
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16400
	    ^self
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16401
	].
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16402
	aTwoArgBlock value:nameAndClassNameOrNil first value:nameAndClassNameOrNil second.
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16403
	idx := idx + 1.
19336
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16404
    ]
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16405
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16406
    "
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16407
     |top sub|
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16408
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16409
     top := self key:'HKEY_LOCAL_MACHINE'.
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16410
     top subKeyNamesAndClassesDo:[:nm :cls |
19338
4733b348640d type casts for mingw
Claus Gittinger <cg@exept.de>
parents: 19336
diff changeset
 16411
	Transcript showCR:('name: ',nm,' class: ',cls)
19336
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16412
     ]
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16413
    "
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16414
!
1604ec6ee7c2 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19335
diff changeset
 16415
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16416
subKeys
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16417
    "return a collection of subKeys below the receiver"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16418
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16419
    |idx subEntry subKeys|
5135
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16420
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16421
    subKeys := OrderedCollection new.
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16422
    self subKeysDo:[:k | subKeys add:k].
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16423
    ^ subKeys
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16424
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16425
    "
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16426
     |top sub|
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16427
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16428
     top := self key:'HKEY_LOCAL_MACHINE'.
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16429
     top subKeys
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16430
    "
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16431
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16432
    "Created: / 23.12.1999 / 22:15:22 / cg"
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16433
    "Modified: / 23.12.1999 / 22:15:44 / cg"
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16434
!
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 16435
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16436
subKeysDo:aBlock
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16437
    "evaluate aBlock for all subKeys below the receiver"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16438
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16439
    |idx subEntry|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16440
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16441
    idx := 0.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16442
    [true] whileTrue:[
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16443
	subEntry := self subKeyAtIndex:idx.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16444
	subEntry isNil ifTrue:[
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16445
	    ^self
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16446
	].
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16447
	aBlock value:subEntry.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16448
	subEntry close.
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16449
	idx := idx + 1.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16450
    ]
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
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16453
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16454
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16455
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16456
     top subKeysDo:[:subEntry |
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16457
	Transcript showCR:subEntry path
19532
e7cbf86b25d5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19499
diff changeset
 16458
     ]
e7cbf86b25d5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19499
diff changeset
 16459
    "
e7cbf86b25d5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19499
diff changeset
 16460
    "
e7cbf86b25d5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19499
diff changeset
 16461
     |top sub|
e7cbf86b25d5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19499
diff changeset
 16462
e7cbf86b25d5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19499
diff changeset
 16463
     top := self key:'HKEY_LOCAL_MACHINE'.
e7cbf86b25d5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19499
diff changeset
 16464
     OSErrorHolder noPermissionsSignal handle:[:ex |
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16465
	ex proceed
19532
e7cbf86b25d5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19499
diff changeset
 16466
     ] do:[
19651
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16467
	 top subKeysDo:[:subEntry |
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16468
	    Transcript showCR:subEntry path
59a06f7e5116 avoid largeinteger arithmetic in osTime handling
Claus Gittinger <cg@exept.de>
parents: 19578
diff changeset
 16469
	 ]
9156
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
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16472
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16473
13223
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 16474
valueNames
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 16475
    "evaluate aBlock for all value names"
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 16476
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 16477
    ^ Array streamContents:[:s |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16478
	self valueNamesDo:[:nm | s nextPut:nm]
13223
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 16479
    ].
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 16480
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 16481
    "Created: / 18-01-2011 / 20:24:52 / cg"
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 16482
!
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 16483
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16484
valueNamesAndValuesDo:aBlock
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16485
    "evaluate aBlock for all value names"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16486
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16487
    self valueNamesDo:[:nm |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16488
	aBlock value:nm value:(self valueNamed:nm)
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16489
    ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16490
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16491
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16492
     |key|
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
     key := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16495
     key valueNamesAndValuesDo:[:nm :val |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16496
	Transcript showCR:(nm , ' -> ' , val storeString).
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16497
     ]
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
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16500
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16501
valueNamesDo:aBlock
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16502
    "evaluate aBlock for all value names"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16503
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16504
    |idx valueName|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16505
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16506
    idx := 0.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16507
    [true] whileTrue:[
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16508
	valueName := self valueNameAtIndex:idx.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16509
	valueName isNil ifTrue:[
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16510
	    ^self
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16511
	].
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16512
	aBlock value:valueName.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16513
	idx := idx + 1.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16514
    ]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16515
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16516
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16517
!Win32OperatingSystem::RegistryEntry methodsFor:'instance release'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16518
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16519
close
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16520
    "close mySelf"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16521
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16522
    self closeKey.
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 16523
    self unregisterForFinalization.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16524
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16525
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16526
closeKey
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16527
    "close mySelf"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16528
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16529
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16530
    HKEY myKey;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16531
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16532
    if (__isExternalAddressLike(__INST(handle))) {
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16533
	myKey = (HKEY)(__externalAddressVal(__INST(handle)));
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16534
	__INST(handle) = nil;
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16535
	RegCloseKey(myKey);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16536
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16537
%}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16538
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16539
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 16540
finalizationLobby
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 16541
    ^ Lobby
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 16542
!
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 16543
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16544
finalize
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16545
    "some entry has been collected - close it"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16546
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16547
    handle notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16548
	self closeKey.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16549
    ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16550
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16551
    "Created: / 19.5.1999 / 22:39:52 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16552
    "Modified: / 19.5.1999 / 22:44:50 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16553
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16554
11135
db5762c9d81b #getDomainName - Domain is found in CurrentControlSet - no need
Stefan Vogel <sv@exept.de>
parents: 11129
diff changeset
 16555
!Win32OperatingSystem::RegistryEntry methodsFor:'printing & storing'!
db5762c9d81b #getDomainName - Domain is found in CurrentControlSet - no need
Stefan Vogel <sv@exept.de>
parents: 11129
diff changeset
 16556
db5762c9d81b #getDomainName - Domain is found in CurrentControlSet - no need
Stefan Vogel <sv@exept.de>
parents: 11129
diff changeset
 16557
printOn:aStream
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
 16558
    aStream
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16559
	nextPutAll:self className;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16560
	nextPut:$(;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16561
	nextPutAll:path;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16562
	nextPut:$).
11135
db5762c9d81b #getDomainName - Domain is found in CurrentControlSet - no need
Stefan Vogel <sv@exept.de>
parents: 11129
diff changeset
 16563
! !
db5762c9d81b #getDomainName - Domain is found in CurrentControlSet - no need
Stefan Vogel <sv@exept.de>
parents: 11129
diff changeset
 16564
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16565
!Win32OperatingSystem::RegistryEntry methodsFor:'private'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16566
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16567
setHandle:aHandle path:aPathString
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16568
    handle := aHandle.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16569
    path := aPathString.
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
    "Created: / 19.5.1999 / 22:27:05 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16572
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16573
17619
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 16574
setHandle:aHandle path:aPathString isNew:disposition
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 16575
    handle := aHandle.
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 16576
    path := aPathString.
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 16577
    isNew := disposition.
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 16578
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 16579
    "Created: / 19.5.1999 / 22:27:05 / cg"
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 16580
!
6f162a05d381 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17602
diff changeset
 16581
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16582
setupForHandleValue:integerHandleValue
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16583
    "not normally used - given an integer address,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16584
     return a registry entry. This is provided to
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16585
     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
 16586
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16587
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16588
    HKEY key;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16589
    OBJ t;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16590
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16591
    key = (HKEY)__longIntVal(integerHandleValue);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16592
    if (! key) {
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 16593
	RETURN (nil);
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
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16596
    t = __MKEXTERNALADDRESS(key); __INST(handle) = t; __STORE(self, t);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16597
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16598
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16599
    "Created: / 19.5.1999 / 21:45:05 / cg"
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
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16602
!Win32OperatingSystem::TextMetricsStructure class methodsFor:'instance creation'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16603
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16604
new
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16605
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16606
^super new: self sizeInBytes
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16607
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16608
    "Created: / 02-08-2006 / 16:20:02 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16609
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16610
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 16611
sizeInBytes
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16612
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16613
  ^53
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16614
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16615
    "Created: / 02-08-2006 / 16:20:09 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16616
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16617
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16618
!Win32OperatingSystem::TextMetricsStructure methodsFor:'accessing'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16619
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16620
tmDefaultChar
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16621
    ^self byteAt: 46 + 1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16622
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16623
    "Created: / 02-08-2006 / 16:15:35 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16624
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16625
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16626
tmExternalLeading
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16627
    ^self longAt: 16 + 1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16628
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16629
    "Created: / 02-08-2006 / 16:17:11 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16630
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16631
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16632
tmHeight
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16633
    ^self longAt: 0 + 1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16634
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16635
    "Created: / 02-08-2006 / 16:16:38 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16636
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16637
19499
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16638
!Win32OperatingSystem::Win32ChangeNotificationHandle class methodsFor:'documentation'!
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16639
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16640
documentation
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16641
"
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16642
    I represent a handle on change notifications (directory changes).
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16643
    I can be waited upon in a WaitForHandle / WaitForMultipleObjects call.
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16644
"
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16645
! !
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16646
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16647
!Win32OperatingSystem::Win32ChangeNotificationHandle methodsFor:'release'!
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16648
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16649
close
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16650
    "close the handle"
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16651
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16652
    self closeHandle.
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16653
    self unregisterForFinalization.
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16654
! !
ee8d773cead9 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19423
diff changeset
 16655
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16656
!Win32OperatingSystem::Win32IOHandle class methodsFor:'documentation'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16657
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16658
documentation
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16659
"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16660
    I represent a handle on which I/O is possible.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16661
    Typical instances are File-Handles, Socket-Handles etc.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16662
"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16663
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 16664
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16665
!Win32OperatingSystem::Win32IOHandle methodsFor:'io'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16666
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16667
readBytes:count into:aByteBuffer startingAt:firstIndex
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16668
    "read count bytes into a byte-buffer;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16669
     Return the number of bytes read (negative on error)"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16670
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16671
    |errSym errorNumber|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16672
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16673
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16674
    unsigned char *extPtr;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16675
    int bufferIsExternalBytes;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16676
    int mustFreeBuffer = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16677
    int nRead = -1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16678
    HANDLE hFile = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16679
    DWORD cntWanted, offs, cntRead;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16680
    int bufferSize;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16681
    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
 16682
    int ok;
9156
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
    if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16685
	errSym = @symbol(errorNotOpen);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16686
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16687
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16688
    if (! __bothSmallInteger(count, firstIndex)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16689
	errSym = @symbol(badArgument);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16690
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16691
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16692
    cntWanted = __smallIntegerVal(count);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16693
    if (cntWanted <= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16694
	errSym = @symbol(badCount);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16695
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16696
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16697
    offs = __smallIntegerVal(firstIndex) - 1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16698
    if (offs < 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16699
	errSym = @symbol(badOffset);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16700
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16701
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16702
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16703
    bufferIsExternalBytes = __isExternalBytesLike(aByteBuffer);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16704
    if (! bufferIsExternalBytes) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16705
	if (__isByteArray(aByteBuffer)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16706
	    bufferSize = __byteArraySize(aByteBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16707
	} else if (__isString(aByteBuffer)) {  // not isStringLike here !
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16708
	    bufferSize = __stringSize(aByteBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16709
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16710
	    errSym = @symbol(badBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16711
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16712
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16713
	if (bufferSize < (cntWanted + offs)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16714
	    errSym = @symbol(badBufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16715
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16716
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16717
	if (cntWanted <= sizeof(miniBuffer)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16718
	    extPtr = miniBuffer;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16719
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16720
	    extPtr = malloc(cntWanted);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16721
	    mustFreeBuffer = 1;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16722
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16723
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16724
	OBJ sz;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16725
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16726
	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
 16727
	if (extPtr == NULL) goto bad;
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16728
	sz = __externalBytesSize(aByteBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16729
	if (! __isSmallInteger(sz)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16730
	    errSym = @symbol(badBufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16731
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16732
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16733
	bufferSize = __smallIntegerVal(sz);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16734
	if (bufferSize < (cntWanted + offs)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16735
	    errSym = @symbol(badBufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16736
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16737
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16738
	extPtr = extPtr + offs;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16739
    }
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
    do {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16742
	__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
 16743
	// 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
 16744
	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
 16745
    } while(__threadErrno == EINTR);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16746
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16747
    if (ok == TRUE) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16748
	if (! bufferIsExternalBytes) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16749
	    /* copy over */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16750
	    memcpy(__byteArrayVal(aByteBuffer)+offs, extPtr, cntRead);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16751
	    if (mustFreeBuffer) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16752
		free(extPtr);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16753
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16754
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16755
	RETURN (__mkSmallInteger(cntRead));
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16756
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16757
    errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
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
bad: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16760
    if (mustFreeBuffer) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16761
	free(extPtr);
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
9154
d7f8a015da92 more com experiments
Claus Gittinger <cg@exept.de>
parents: 9153
diff changeset
 16765
    errorNumber isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16766
	self error:'invalid argument(s): ', errSym.
9155
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 16767
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16768
	(OperatingSystem errorHolderForNumber:errorNumber) reportError
9155
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 16769
    ].
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 16770
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16771
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16772
     |h buff n|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16773
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16774
     h := self basicNew.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16775
     buff := ByteArray new:10.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16776
     n := h readBytes:10 into:buff startingAt:1.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16777
     Transcript show:n; show:' '; showCR:buff.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16778
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16779
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16780
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16781
readWaitWithTimeoutMs:millis
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16782
    "return true if a timeout occurred"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16783
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16784
    |errSym errorNumber|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16785
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16786
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16787
    HANDLE hFile = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16788
    DWORD res;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16789
    INT t;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16790
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16791
    if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16792
	errSym = @symbol(errorNotOpen);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16793
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16794
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16795
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16796
#if 0
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16797
    if (ioctlsocket((SOCKET)hFile, FIONREAD, &res)==0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16798
	/* its a socket */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16799
	if (res > 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16800
	    RETURN ( false );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16801
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16802
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16803
    if (PeekNamedPipe(hFile, 0, 0, 0, &res, 0)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16804
	/* its a namedPipe */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16805
	if (res > 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16806
	    RETURN ( false );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16807
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16808
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16809
#endif
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16810
    if (__isSmallInteger(millis)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16811
	t = __intVal(millis);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16812
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16813
	t = INFINITE;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16814
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16815
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16816
    do {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16817
	__threadErrno = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16818
	res = WaitForSingleObject(hFile, t);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16819
    } while (__threadErrno == EINTR);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16820
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16821
    switch (res) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16822
	case WAIT_OBJECT_0:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16823
	    /* signalled */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16824
	    RETURN ( false );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16825
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16826
	case WAIT_TIMEOUT:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16827
	    /* signalled */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16828
	    RETURN ( true );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16829
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16830
	default:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16831
	case WAIT_ABANDONED:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16832
	    errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16833
	    goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16834
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16835
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16836
bad: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16837
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16838
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16839
     timeout argument not integer,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16840
     or any fd-array nonNil and not an array
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16841
     or not supported by OS
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16842
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16843
    ^ self primitiveFailed
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16844
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16845
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16846
seekTo:newPosition from:whence
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16847
    "whence is one of:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16848
	#begin
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16849
	#current
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16850
	#end
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16851
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16852
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16853
    |errSym errorNumber|
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
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16856
    HANDLE hFile = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16857
    DWORD moveHow;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16858
    LONG posLo, posHi = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16859
    __uint64__ pos64, newPos64;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16860
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16861
    if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16862
	errSym = @symbol(errorNotOpen);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16863
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16864
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16865
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16866
    if (whence == @symbol(begin)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16867
	moveHow = FILE_BEGIN;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16868
    } else if (whence == @symbol(current)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16869
	moveHow = FILE_CURRENT;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16870
    } else if (whence == @symbol(end)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16871
	moveHow = FILE_END;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16872
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16873
	errSym = @symbol(badArgument2);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16874
	goto bad;
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16875
    }
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16876
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16877
    if (__signedLong64IntVal(newPosition, &pos64) == 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16878
	errSym = @symbol(badArgument);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16879
	goto bad;
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16880
    }
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16881
#if __POINTER_SIZE__ == 8
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16882
    posLo = pos64 & 0xFFFFFFFF;
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16883
    posHi = (pos64 >> 32) & 0xFFFFFFFF;
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16884
#else
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16885
    posLo = pos64.lo;
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16886
    posHi = pos64.hi;
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16887
#endif
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16888
    posLo = SetFilePointer(hFile, posLo, &posHi, moveHow);
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16889
    if (posLo == 0xFFFFFFFF) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16890
	int lastError;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16891
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16892
	/* can be either an error, or a valid low-word */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16893
	lastError = GetLastError();
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16894
	if (lastError != NO_ERROR) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16895
	    errorNumber = __mkSmallInteger( __WIN32_ERR(lastError) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16896
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16897
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16898
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16899
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16900
    if (posHi == 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16901
	RETURN (__MKUINT( posLo ));
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16902
    }
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16903
#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
 16904
    newPos64 = (__uint64__)posLo | ((__uint64__)posHi << 32);
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16905
    RETURN ( __MKUINT(newPos64) );
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16906
#else
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16907
    newPos64.lo = posLo;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16908
    newPos64.hi = posHi;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16909
    RETURN ( __MKUINT64(&newPos64) );
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16910
#endif
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16911
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16912
bad: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16913
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16914
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16915
    errorNumber isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16916
	self error:'invalid argument(s): ', errSym.
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16917
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16918
	(OperatingSystem errorHolderForNumber:errorNumber) reportError
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16919
    ].
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16920
!
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16921
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16922
writeBytes:count from:aByteBuffer startingAt:firstIndex
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16923
    "write count bytes from a byte-buffer;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16924
     Return the number of bytes written (negative on error)"
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
    |errSym errorNumber|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16927
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16928
    unsigned char *extPtr;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16929
    int bufferIsExternalBytes;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16930
    int mustFreeBuffer = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16931
    int nWritten = -1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16932
    HANDLE hFile = (HANDLE)(__externalAddressVal(self));
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 16933
    DWORD cntWanted, offs, cntWritten;
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 16934
    int bufferSize;
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16935
    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
 16936
    int ok;
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 16937
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 16938
    if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16939
	errSym = @symbol(errorNotOpen);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16940
	goto bad;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 16941
    }
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16942
    if (! __bothSmallInteger(count, firstIndex)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16943
	errSym = @symbol(badArgument);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16944
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16945
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16946
    cntWanted = __smallIntegerVal(count);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16947
    if (cntWanted <= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16948
	errSym = @symbol(badCount);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16949
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16950
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16951
    offs = __smallIntegerVal(firstIndex) - 1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16952
    if (offs < 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16953
	errSym = @symbol(badOffset);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16954
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16955
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16956
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16957
    bufferIsExternalBytes = __isExternalBytesLike(aByteBuffer);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16958
    if (! bufferIsExternalBytes) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16959
	if (__isByteArray(aByteBuffer)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16960
	    bufferSize = __byteArraySize(aByteBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16961
	} else if (__isStringLike(aByteBuffer)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16962
	    bufferSize = __stringSize(aByteBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16963
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16964
	    errSym = @symbol(badBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16965
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16966
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16967
	if (bufferSize < (cntWanted + offs)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16968
	    errSym = @symbol(badBufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16969
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16970
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16971
	if (cntWanted <= sizeof(miniBuffer)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16972
	    extPtr = miniBuffer;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16973
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16974
	    extPtr = malloc(cntWanted);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16975
	    mustFreeBuffer = 1;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16976
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16977
	memcpy(extPtr, __byteArrayVal(aByteBuffer)+offs, cntWanted);
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 16978
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16979
	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
 16980
	if (extPtr == NULL) goto bad;
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16981
	bufferSize = __externalBytesSize(aByteBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16982
	if (! __isSmallInteger(bufferSize)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16983
	    errSym = @symbol(badBufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16984
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16985
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16986
	bufferSize = __smallIntegerVal(bufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16987
	if (bufferSize < (cntWanted + offs)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16988
	    errSym = @symbol(badBufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16989
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16990
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16991
	extPtr = extPtr + offs;
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16992
    }
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16993
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16994
    do {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16995
	__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
 16996
	// 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
 16997
	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
 16998
    } while(__threadErrno == EINTR);
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16999
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 17000
    if (ok == TRUE) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17001
	if (mustFreeBuffer) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17002
	    free(extPtr);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17003
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17004
	RETURN (__mkSmallInteger(cntWritten));
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 17005
    }
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 17006
    errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 17007
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 17008
bad: ;
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 17009
    if (mustFreeBuffer) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17010
	free(extPtr);
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 17011
    }
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 17012
%}.
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 17013
    errorNumber isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17014
	self error:'invalid argument(s): ', errSym.
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 17015
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17016
	(OperatingSystem errorHolderForNumber:errorNumber) reportError
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 17017
    ].
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 17018
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 17019
    "
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 17020
     |h buff n|
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 17021
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 17022
     h := self basicNew.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 17023
     h setFileDescriptor:1.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 17024
     buff := '12345678901234567890'.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 17025
     n := h writeBytes:10 from:buff startingAt:1.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 17026
    "
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17027
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17028
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17029
!Win32OperatingSystem::Win32IOHandle methodsFor:'release'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17030
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17031
close
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17032
    "close the file"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17033
16345
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 17034
    self closeHandle.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17035
    self unregisterForFinalization.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17036
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17037
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17038
!Win32OperatingSystem::Win32NetworkResourceHandle class methodsFor:'accessing - types'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17039
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17040
displayTypeMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17041
    "answer a Dictionary containing displayTypes symbols to integer mapping and vice versa"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17042
    | symbTable |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17043
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17044
    DisplayTypeMappingTable notNil ifTrue:[ ^ DisplayTypeMappingTable ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17045
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17046
    symbTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17047
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17048
    __AT_PUT_(symbTable , @symbol(GENERIC),      __MKUINT( RESOURCEDISPLAYTYPE_GENERIC ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17049
    __AT_PUT_(symbTable , @symbol(DOMAIN),       __MKUINT( RESOURCEDISPLAYTYPE_DOMAIN ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17050
    __AT_PUT_(symbTable , @symbol(SERVER),       __MKUINT( RESOURCEDISPLAYTYPE_SERVER ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17051
    __AT_PUT_(symbTable , @symbol(SHARE),        __MKUINT( RESOURCEDISPLAYTYPE_SHARE ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17052
    __AT_PUT_(symbTable , @symbol(FILE),         __MKUINT( RESOURCEDISPLAYTYPE_FILE ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17053
    __AT_PUT_(symbTable , @symbol(GROUP),        __MKUINT( RESOURCEDISPLAYTYPE_GROUP ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17054
    __AT_PUT_(symbTable , @symbol(NETWORK),      __MKUINT( RESOURCEDISPLAYTYPE_NETWORK ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17055
    __AT_PUT_(symbTable , @symbol(ROOT),         __MKUINT( RESOURCEDISPLAYTYPE_ROOT ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17056
    __AT_PUT_(symbTable , @symbol(SHAREADMIN),   __MKUINT( RESOURCEDISPLAYTYPE_SHAREADMIN ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17057
    __AT_PUT_(symbTable , @symbol(DIRECTORY),    __MKUINT( RESOURCEDISPLAYTYPE_DIRECTORY ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17058
    __AT_PUT_(symbTable , @symbol(TREE),         __MKUINT( RESOURCEDISPLAYTYPE_TREE ) );
15580
4f1aa9df6162 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15547
diff changeset
 17059
#ifdef RESOURCEDISPLAYTYPE_NDSCONTAINER
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17060
    __AT_PUT_(symbTable , @symbol(NDSCONTAINER), __MKUINT( RESOURCEDISPLAYTYPE_NDSCONTAINER ) );
15580
4f1aa9df6162 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15547
diff changeset
 17061
#endif
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17062
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17063
    DisplayTypeMappingTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17064
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17065
    symbTable keysAndValuesDo:[:aSYMB :anINT |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17066
	DisplayTypeMappingTable at: aSYMB put: anINT.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17067
	DisplayTypeMappingTable at: anINT put: aSYMB. "/ vice versa
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17068
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17069
    ^ DisplayTypeMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17070
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17071
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17072
scopeMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17073
    "answer a Dictionary with scopes mapping symbol to integer and vice verca"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17074
    | symbTable |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17075
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17076
    ScopeMappingTable notNil ifTrue:[ ^ ScopeMappingTable].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17077
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17078
    symbTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17079
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17080
    __AT_PUT_(symbTable, @symbol(CONNECTED),  __MKUINT( RESOURCE_CONNECTED ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17081
    __AT_PUT_(symbTable, @symbol(CONTEXT),    __MKUINT( RESOURCE_CONTEXT ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17082
    __AT_PUT_(symbTable, @symbol(GLOBALNET),  __MKUINT( RESOURCE_GLOBALNET ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17083
    __AT_PUT_(symbTable, @symbol(REMEMBERED), __MKUINT( RESOURCE_REMEMBERED ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17084
    __AT_PUT_(symbTable, @symbol(RECENT),     __MKUINT( RESOURCE_RECENT ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17085
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17086
    ScopeMappingTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17087
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17088
    symbTable keysAndValuesDo:[:aSYMB :anINT |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17089
	ScopeMappingTable at: aSYMB put: anINT.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17090
	ScopeMappingTable at: anINT put: aSYMB. "/ vice versa
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17091
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17092
    ^ ScopeMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17093
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17094
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17095
typeMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17096
    "answer a Dictionary containing types symbols to integer mapping and vice versa"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17097
    | symbTable |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17098
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17099
    TypeMappingTable notNil ifTrue:[ ^ TypeMappingTable].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17100
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17101
    symbTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17102
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17103
    __AT_PUT_(symbTable , @symbol(ANY),      __MKUINT( RESOURCETYPE_ANY ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17104
    __AT_PUT_(symbTable , @symbol(DISK),     __MKUINT( RESOURCETYPE_DISK ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17105
    __AT_PUT_(symbTable , @symbol(PRINT),    __MKUINT( RESOURCETYPE_PRINT ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17106
    __AT_PUT_(symbTable , @symbol(UNKNOWN),  __MKUINT( RESOURCETYPE_UNKNOWN ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17107
    __AT_PUT_(symbTable , @symbol(RESERVED), __MKUINT( RESOURCETYPE_RESERVED ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17108
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17109
    TypeMappingTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17110
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17111
    symbTable keysAndValuesDo:[:aSYMB :anINT |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17112
	TypeMappingTable at: aSYMB put: anINT.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17113
	TypeMappingTable at: anINT put: aSYMB. "/ vice versa
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17114
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17115
    ^ TypeMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17116
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17117
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17118
usageMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17119
    "answer a Dictionary containing usages symbols to integer mapping and vice versa"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17120
    | symbTable |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17121
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17122
    UsageMappingTable notNil ifTrue:[ ^ UsageMappingTable].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17123
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17124
    symbTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17125
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17126
    __AT_PUT_(symbTable , @symbol(NULL),          __MKUINT( 0 ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17127
    __AT_PUT_(symbTable , @symbol(CONNECTABLE),   __MKUINT( RESOURCEUSAGE_CONNECTABLE ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17128
    __AT_PUT_(symbTable , @symbol(CONTAINER),     __MKUINT( RESOURCEUSAGE_CONTAINER ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17129
    __AT_PUT_(symbTable , @symbol(ATTACHED),      __MKUINT( RESOURCEUSAGE_ATTACHED ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17130
    __AT_PUT_(symbTable , @symbol(ALL),           __MKUINT( RESOURCEUSAGE_ALL ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17131
    __AT_PUT_(symbTable , @symbol(NOLOCALDEVICE), __MKUINT( RESOURCEUSAGE_NOLOCALDEVICE ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17132
    __AT_PUT_(symbTable , @symbol(SIBLING),       __MKUINT( RESOURCEUSAGE_SIBLING ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17133
    __AT_PUT_(symbTable , @symbol(RESERVED),      __MKUINT( RESOURCEUSAGE_RESERVED ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17134
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17135
    UsageMappingTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17136
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17137
    symbTable keysAndValuesDo:[:aSYMB :anINT |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17138
	UsageMappingTable at: aSYMB put: anINT.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17139
	UsageMappingTable at: anINT put: aSYMB. "/ vice versa
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17140
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17141
    ^ UsageMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17142
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17143
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17144
!Win32OperatingSystem::Win32NetworkResourceHandle class methodsFor:'fetch resources'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17145
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17146
fetchResourcesStartingAt: aNetworkResourceOrNil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17147
    withScope: aScope type: aType usage: aUsage onError: aBlock
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17148
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17149
    "Fetch all resources from the given network resource or if nil the root system.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17150
     On success a collection of al network resources is returned.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17151
     If the open fails, the error block if notNil will be evaluated with the error number
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17152
     and nil is returned.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17153
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17154
    self fetchResourcesStartingAt: nil withScope: #GLOBALNET type: #ANY usage: 0
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17155
	onError: [:err| Transcript showCR: err ].
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17156
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17157
    | stream networkResources |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17158
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17159
    [
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17160
	stream := self openAt: aNetworkResourceOrNil
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17161
	    withScope: aScope type: aType usage: aUsage onError: aBlock.
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17162
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17163
	stream notNil ifTrue:[
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17164
	    |next|
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17165
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17166
	    networkResources := OrderedCollection new.
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17167
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17168
	    [ (next := stream nextOrNil) notNil ] whileTrue:[
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17169
		networkResources add:next.
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17170
	    ].
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17171
	]
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17172
    ] ensure:[
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17173
	stream notNil ifTrue:[ stream close ].
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17174
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17175
    ^ networkResources.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17176
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17177
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17178
fetchSystemResourcesWithScope: aScope type: aType usage: aUsage onError: aBlock
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17179
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17180
    "Fetch all system resources.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17181
     On success a collection of al network resources is returned.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17182
     If the open fails, the error block if notNil will be evaluated with the error number
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17183
     and nil is returned.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17184
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17185
    self fetchSystemResourcesWithScope: #GLOBALNET type: #ANY usage: 0
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17186
	onError: [:err| Transcript showCR: err ].
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17187
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17188
    self fetchSystemResourcesWithScope: #REMEMBERED type: #DISK usage: 0
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17189
	onError: [:err| Transcript showCR: err ].
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17190
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17191
    self fetchSystemResourcesWithScope: #REMEMBERED type: #ANY usage: 0
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17192
	onError: [:err| Transcript showCR: err ].
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17193
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17194
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17195
    ^ self fetchResourcesStartingAt: nil
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17196
	    withScope: aScope type: aType usage: aUsage onError: aBlock
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17197
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17198
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17199
fetchVirtualDrives
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17200
    "answer a collection of virtual drive resources
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17201
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17202
     self fetchVirtualDrives
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17203
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17204
    ^ self fetchSystemResourcesWithScope: #REMEMBERED type: #DISK usage: 0 onError: nil.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17205
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17206
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17207
!Win32OperatingSystem::Win32NetworkResourceHandle class methodsFor:'opening'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17208
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17209
openAt: aResourceOrNil withScope: aScope type: aType usage: aUsage onError: aBlock
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17210
    "Open a handle for network resource enumeratation starting at the given NetworkResource
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17211
     or if nil on the system root. On success the handle will is returned.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17212
     If the open fails, the error block if notNil will be evaluated with the error number
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17213
     and nil is returned.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17214
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17215
    OperatingSystem networkResourceAccessor openOn:nil withScope:#GLOBALNET  type:#ANY  usage:0 onError:nil.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17216
    OperatingSystem networkResourceAccessor openOn:nil withScope:#REMEMBERED type:#DISK usage:0 onError:nil.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17217
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17218
    | resourceHandle errorNumber enumScope enumUsage enumType
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17219
      resScope resType resUsage resDisplayType resComment resLocalName resRemoteName resProvider |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17220
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17221
    "/ map symbols to integer values.. on error an exception is raised
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17222
    aScope isInteger ifTrue:[ enumScope := aScope ]
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17223
		    ifFalse:[ enumScope := self scopeMappingTable at:aScope ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17224
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17225
    aUsage isInteger ifTrue:[ enumUsage := aUsage ]
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17226
		    ifFalse:[ enumUsage := self usageMappingTable at:aUsage ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17227
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17228
    aType isInteger ifTrue:[ enumType := aType ]
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17229
		   ifFalse:[ enumType := self typeMappingTable at:aType ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17230
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17231
    aResourceOrNil notNil ifTrue:[ | checkAndGetString |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17232
	resScope := aResourceOrNil scope.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17233
	resScope isInteger ifFalse:[ resScope := self scopeMappingTable at:resScope ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17234
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17235
	resType := aResourceOrNil type.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17236
	resType isInteger ifFalse:[ resType := self typeMappingTable at: resType ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17237
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17238
	resUsage := aResourceOrNil usage.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17239
	resUsage isInteger ifFalse:[ resUsage := self usageMappingTable at: resUsage ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17240
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17241
	resDisplayType := aResourceOrNil displayType.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17242
	resDisplayType isInteger ifFalse:[ resDisplayType := self displayTypeMappingTable at:resDisplayType ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17243
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17244
	checkAndGetString := [: aString| |string|
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17245
	    aString notNil ifTrue:[
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17246
		self isUsingUnicode
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17247
		    ifTrue: [ string := aString asUnicode16String  ]
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17248
		    ifFalse:[ string := aString asSingleByteString ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17249
	    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17250
	    string
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17251
	].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17252
	resRemoteName  := checkAndGetString value:( aResourceOrNil remoteName ).
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17253
	resLocalName   := checkAndGetString value:( aResourceOrNil localName ).
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17254
	resComment     := checkAndGetString value:( aResourceOrNil comment ).
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17255
	resProvider    := checkAndGetString value:( aResourceOrNil provider ).
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17256
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17257
    resourceHandle := self new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17258
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17259
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17260
    HANDLE __hEnum;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17261
    int    __errno;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17262
    DWORD  __scope = __unsignedLongIntVal( enumScope );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17263
    DWORD  __usage = __unsignedLongIntVal( enumUsage );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17264
    DWORD  __type  = __unsignedLongIntVal( enumType );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17265
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17266
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17267
    char           __buffer[ 8192 ];
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17268
    LPNETRESOURCE  __lpnetRes = (LPNETRESOURCE) __buffer;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17269
    char *         __cp = __buffer + sizeof(NETRESOURCE);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17270
    char *         __sp;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17271
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17272
    wchar_t        __buffer[ 8192 ];
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17273
    LPNETRESOURCEW __lpnetRes = (LPNETRESOURCEW) __buffer;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17274
    wchar_t *      __cp = __buffer + sizeof(NETRESOURCEW);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17275
    wchar_t *      __sp;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17276
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17277
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17278
    if( resScope == nil ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17279
	__lpnetRes = 0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17280
    } else {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17281
	int __sz;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17282
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17283
	ZeroMemory( __buffer, (__cp - __buffer) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17284
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17285
	__lpnetRes->dwScope       = __unsignedLongIntVal( resScope );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17286
	__lpnetRes->dwType        = __unsignedLongIntVal( resType  );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17287
	__lpnetRes->dwUsage       = __unsignedLongIntVal( resUsage );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17288
	__lpnetRes->dwDisplayType = __unsignedLongIntVal( resDisplayType );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17289
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17290
	if( resRemoteName != nil ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17291
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17292
	    __sp = __stringVal(resRemoteName);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17293
	    __sz = strlen(__sp);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17294
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17295
	    __sp = __unicode16StringVal(resRemoteName);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17296
	    __sz = __unicode16StringSize(resRemoteName);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17297
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17298
	    for( __lpnetRes->lpRemoteName = __cp; __sz > 0; --__sz ) { * __cp++ = * __sp++; }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17299
	    *__cp++ = 0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17300
	}
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17301
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17302
	if( resLocalName != nil ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17303
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17304
	    __sp = __stringVal(resLocalName);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17305
	    __sz = strlen(__sp);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17306
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17307
	    __sp = __unicode16StringVal(resLocalName);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17308
	    __sz = __unicode16StringSize(resLocalName);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17309
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17310
	    for( __lpnetRes->lpLocalName = __cp; __sz > 0; --__sz ) { * __cp++ = * __sp++; }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17311
	    *__cp++ = 0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17312
	}
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17313
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17314
	if( resComment != nil ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17315
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17316
	    __sp = __stringVal(resComment);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17317
	    __sz = strlen(__sp);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17318
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17319
	    __sp = __unicode16StringVal(resComment);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17320
	    __sz = __unicode16StringSize(resComment);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17321
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17322
	    for( __lpnetRes->lpComment = __cp; __sz > 0; --__sz ) { * __cp++ = * __sp++; }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17323
	    *__cp++ = 0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17324
	}
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17325
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17326
	if( resProvider != nil ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17327
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17328
	    __sp = __stringVal(resProvider);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17329
	    __sz = strlen(__sp);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17330
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17331
	    __sp = __unicode16StringVal(resProvider);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17332
	    __sz = __unicode16StringSize(resProvider);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17333
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17334
	    for( __lpnetRes->lpProvider = __cp; __sz > 0; --__sz ) { * __cp++ = * __sp++; }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17335
	    *__cp++ = 0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17336
	}
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17337
    }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17338
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17339
#ifdef DO_WRAP_CALLS
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17340
    do {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17341
	__threadErrno = 0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17342
#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
 17343
	// 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
 17344
	__errno = (int)(STX_API_NOINT_CALL5( "WNetOpenEnumA",  WNetOpenEnumA,  __scope, __type, __usage, __lpnetRes, & __hEnum ));
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17345
#else
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 17346
	// do not cast to INT - will loose sign bit then!
19339
8d679a172fab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19338
diff changeset
 17347
	__errno = (int)(STX_API_NOINT_CALL5( "WNetOpenEnumW", WNetOpenEnumW, __scope, __type, __usage, __lpnetRes, & __hEnum ));
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17348
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17349
    } while ((__errno < 0) && (__threadErrno == EINTR));
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17350
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17351
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17352
#ifdef USE_ANSI_NETWORKRESOURCES
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17353
    __errno = WNetOpenEnumA ( __scope, __type, __usage, __lpnetRes, & __hEnum );
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17354
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17355
    __errno = WNetOpenEnumW( __scope, __type, __usage, __lpnetRes, & __hEnum );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17356
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17357
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17358
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17359
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17360
    if( __errno == NO_ERROR ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17361
	__externalAddressVal(resourceHandle) = (void *) __hEnum;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17362
    } else {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17363
	resourceHandle = nil;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17364
	errorNumber    = __mkSmallInteger( __errno );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17365
    }
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
    resourceHandle isNil ifTrue:[
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17369
	aBlock notNil ifTrue:[ aBlock value: errorNumber ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17370
	^ nil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17371
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17372
    resourceHandle registerForFinalization.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17373
    ^ resourceHandle
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17374
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17375
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17376
!Win32OperatingSystem::Win32NetworkResourceHandle class methodsFor:'testing'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17377
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17378
isUsingUnicode
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17379
    "answer true if we are using unicode; has effect to the open and next operation"
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
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17383
    RETURN( false );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17384
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17385
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17386
    ^ true
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17387
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17388
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17389
!Win32OperatingSystem::Win32NetworkResourceHandle methodsFor:'queries'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17390
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17391
atEnd
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17392
    "answer true if the stream is at the end (no longer valid)"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17393
    ^ (self address == 0)
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17394
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17395
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17396
!Win32OperatingSystem::Win32NetworkResourceHandle methodsFor:'reading'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17397
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17398
nextOrNil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17399
    "answer the next NetworkResource or nil (no more resource available);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17400
     if no more resource is available the stream is closed"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17401
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17402
    | scope type usage displayType comment localName remoteName provider |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17403
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17404
    self atEnd ifTrue:[ ^ nil ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17405
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17406
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17407
    HANDLE __hEnum = (HANDLE)(__externalAddressVal(self));
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17408
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17409
    if ((__hEnum == 0) || (__hEnum == INVALID_HANDLE_VALUE)) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17410
	__externalAddressVal(self) = (HANDLE)0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17411
    } else {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17412
	DWORD           __entries = 1;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17413
	DWORD           __bufSize = 8192;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17414
	int             __errno;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17415
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17416
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17417
	char            __buffer[ 8192 ];
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17418
	LPNETRESOURCE   __lpNetRes  = (LPNETRESOURCE)  __buffer;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17419
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17420
	ZeroMemory( __buffer, sizeof(NETRESOURCE) );
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 17421
	__errno = WNetEnumResourceA ( __hEnum , & __entries , __lpNetRes, & __bufSize );
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17422
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17423
	wchar_t         __buffer[ 8192 ];
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17424
	LPNETRESOURCEW  __lpNetRes  = (LPNETRESOURCEW) __buffer;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17425
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17426
	ZeroMemory( __buffer, sizeof(NETRESOURCEW) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17427
	__errno = WNetEnumResourceW ( __hEnum , & __entries , __lpNetRes, & __bufSize );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17428
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17429
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17430
	if( (__errno  == NO_ERROR) && (__entries == 1) ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17431
	    scope       = __MKUINT( __lpNetRes->dwScope );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17432
	    type        = __MKUINT( __lpNetRes->dwType );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17433
	    usage       = __MKUINT( __lpNetRes->dwUsage );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17434
	    displayType = __MKUINT( __lpNetRes->dwDisplayType );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17435
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17436
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17437
	    if( __lpNetRes->lpRemoteName != 0 ) { remoteName =  __MKSTRING( __lpNetRes->lpRemoteName ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17438
	    if( __lpNetRes->lpLocalName  != 0 ) { localName  =  __MKSTRING( __lpNetRes->lpLocalName ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17439
	    if( __lpNetRes->lpComment    != 0 ) { comment    =  __MKSTRING( __lpNetRes->lpComment ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17440
	    if( __lpNetRes->lpProvider   != 0 ) { provider   =  __MKSTRING( __lpNetRes->lpProvider ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17441
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17442
	    if( __lpNetRes->lpRemoteName != 0 ) { remoteName =  __MKU16STRING( __lpNetRes->lpRemoteName ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17443
	    if( __lpNetRes->lpLocalName  != 0 ) { localName  =  __MKU16STRING( __lpNetRes->lpLocalName ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17444
	    if( __lpNetRes->lpComment    != 0 ) { comment    =  __MKU16STRING( __lpNetRes->lpComment ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17445
	    if( __lpNetRes->lpProvider   != 0 ) { provider   =  __MKU16STRING( __lpNetRes->lpProvider ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17446
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17447
	}
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17448
    }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17449
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17450
    scope notNil ifTrue:[ |netResource|
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17451
	netResource := NetworkResource new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17452
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17453
	"map integer values to symbol excluding the usage..."
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17454
	netResource scope: (self class scopeMappingTable at:scope ifAbsent:[scope]).
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17455
	netResource type:  (self class typeMappingTable  at:type ifAbsent:[type]).
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17456
	netResource displayType: (self class displayTypeMappingTable at:displayType ifAbsent:[displayType]).
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17457
	netResource usage: usage.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17458
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17459
	netResource remoteName: remoteName.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17460
	netResource localName: localName.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17461
	netResource comment: comment.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17462
	netResource provider: provider.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17463
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17464
	^ netResource
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17465
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17466
    self close.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17467
    ^ nil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17468
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17469
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17470
!Win32OperatingSystem::Win32NetworkResourceHandle methodsFor:'release'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17471
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17472
closeHandle
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17473
    "close the handle"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17474
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17475
    self address == 0 ifTrue:[ ^ self ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17476
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17477
    HANDLE __hEnum = (HANDLE)(__externalAddressVal(self));
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17478
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17479
    if (__hEnum) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17480
	__externalAddressVal(self) = (HANDLE)0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17481
	WNetCloseEnum(__hEnum);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17482
    }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17483
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17484
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17485
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17486
!Win32OperatingSystem::Win32NetworkResourceHandle::NetworkResource methodsFor:'accessing'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17487
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17488
comment
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17489
    "comment supplied by the network provider or nil"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17490
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17491
    ^ comment
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
comment: aStringOrNil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17495
    "comment supplied by the network provider or nil"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17496
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17497
    comment := aStringOrNil.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17498
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17499
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17500
displayType
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17501
    "The display options for the network object in a network browsing user interface"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17502
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17503
    ^ displayType
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17504
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17505
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17506
displayType: theDisplayType
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17507
    "The display options for the network object in a network browsing user interface"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17508
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17509
    displayType := theDisplayType.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17510
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17511
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17512
localName
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17513
    "if the scope member is equal to RESOURCE_CONNECTED or RESOURCE_REMEMBERED,
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17514
     this specifies the name of a local device. This member is NULL if the connection
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17515
     does not use a device."
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17516
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17517
    ^ localName
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17518
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17519
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17520
localName: aStringOrNil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17521
    "if the scope member is equal to RESOURCE_CONNECTED or RESOURCE_REMEMBERED,
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17522
     this specifies the name of a local device. This member is NULL if the connection
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17523
     does not use a device."
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17524
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17525
    localName := aStringOrNil.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17526
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17527
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17528
provider
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17529
    "the name of the provider that owns the resource or nil"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17530
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17531
    ^ provider
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17532
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17533
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17534
provider: aStringOrNil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17535
    "the name of the provider that owns the resource or nil"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17536
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17537
    provider := aStringOrNil.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17538
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17539
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17540
remoteName
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17541
    "If the resource is a network resource, this specifies the remote network name.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17542
     If the resource is a current or persistent connection, this specifies the network
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17543
     name associated with the name pointed to by the localName"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17544
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17545
    ^ remoteName
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17546
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17547
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17548
remoteName: aStringOrNil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17549
    "If the resource is a network resource, this specifies the remote network name.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17550
     If the resource is a current or persistent connection, this specifies the network
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17551
     name associated with the name pointed to by the localName"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17552
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17553
    remoteName := aStringOrNil.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17554
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17555
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17556
scope
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17557
    "The scope of the enumeration
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17558
	RESOURCE_CONNECTED RESOURCE_GLOBALNET RESOURCE_REMEMBERED
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17559
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17560
    ^ scope
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17561
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17562
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17563
scope: theScope
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17564
    "The scope of the enumeration
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17565
	RESOURCE_CONNECTED RESOURCE_GLOBALNET RESOURCE_REMEMBERED
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17566
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17567
    scope := theScope.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17568
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17569
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17570
type
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17571
    "describes the type of the resource
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17572
	RESOURCETYPE_ANY  RESOURCETYPE_DISK  RESOURCETYPE_PRINT
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17573
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17574
    ^ type
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17575
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17576
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17577
type: theType
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17578
    "describes the type of the resource
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17579
	RESOURCETYPE_ANY  RESOURCETYPE_DISK  RESOURCETYPE_PRINT
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17580
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17581
    type := theType.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17582
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17583
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17584
usage
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17585
    "a set of bit flags (INTEGER) describing how the resource can be used"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17586
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17587
    ^ usage
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17588
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17589
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17590
usage: anInteger
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17591
    "a set of bit flags (INTEGER) describing how the resource can be used"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17592
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17593
    usage := anInteger.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17594
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17595
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17596
!Win32OperatingSystem::Win32NetworkResourceHandle::NetworkResource methodsFor:'printing'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17597
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17598
printOn: aStream
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17599
    "print self on a stream"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17600
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17601
    | paction |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17602
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17603
    paction := [: anIdentifier :theValue |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17604
	anIdentifier printOn: aStream.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17605
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17606
	theValue notNil ifTrue:[
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17607
	    theValue isInteger ifTrue:[
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17608
		theValue printOn:aStream base:2 showRadix:true.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17609
	    ] ifFalse:[
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17610
		theValue isSymbol ifTrue:[
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17611
		    theValue printOn: aStream.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17612
		] ifFalse:[
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17613
		    aStream nextPut: $". theValue printOn: aStream. aStream nextPut: $"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17614
		]
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17615
	    ]
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17616
	].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17617
	aStream cr.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17618
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17619
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17620
    aStream nextPutAll: 'NetworkResource {'; cr.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17621
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17622
    paction value: '  Scope:        ' value:scope.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17623
    paction value: '  Type:         ' value:type.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17624
    paction value: '  DisplayType:  ' value:displayType.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17625
    paction value: '  Usage(mask):  ' value:usage.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17626
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17627
    aStream cr.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17628
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17629
    paction value: '  RemoteName:   ' value:remoteName.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17630
    paction value: '  LocalName:    ' value:localName.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17631
    paction value: '  Comment       ' value:comment.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17632
    paction value: '  Provider      ' value:provider.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17633
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17634
    aStream nextPut: $}; cr.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17635
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17636
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17637
!Win32OperatingSystem::Win32NetworkResourceHandle::NetworkResource methodsFor:'queries'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17638
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17639
isResourceContainer
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17640
    "answer true if the resource is a resource container"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17641
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17642
    | flag |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17643
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17644
    usage isInteger ifFalse:[ ^ usage = #CONTAINER ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17645
    flag := usage.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17646
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17647
    DWORD __usage = __unsignedLongIntVal( flag );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17648
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17649
    if( __usage & RESOURCEUSAGE_CONTAINER ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17650
	RETURN( true );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17651
    }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17652
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17653
    ^ false
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17654
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 17655
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17656
!Win32OperatingSystem::Win32PrinterHandle methodsFor:'release'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17657
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17658
closeHandle
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17659
    self address ~~ 0 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17660
	OperatingSystem primClosePrinter:self.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17661
    ]
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17662
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17663
    "Created: / 27-07-2006 / 14:48:37 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17664
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17665
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17666
!Win32OperatingSystem::Win32ProcessHandle methodsFor:'accessing'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17667
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17668
pid
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17669
    ^ pid
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17670
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17671
16334
41fddda3b611 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16331
diff changeset
 17672
!Win32OperatingSystem::Win32ProcessHandle methodsFor:'comparing'!
41fddda3b611 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16331
diff changeset
 17673
41fddda3b611 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16331
diff changeset
 17674
= aWin32ProcessHandle
41fddda3b611 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16331
diff changeset
 17675
    ^ aWin32ProcessHandle class == self class and:[pid = aWin32ProcessHandle pid]
41fddda3b611 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16331
diff changeset
 17676
!
41fddda3b611 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16331
diff changeset
 17677
41fddda3b611 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16331
diff changeset
 17678
hash
41fddda3b611 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16331
diff changeset
 17679
    ^ pid hash
41fddda3b611 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16331
diff changeset
 17680
! !
41fddda3b611 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16331
diff changeset
 17681
12632
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 17682
!Win32OperatingSystem::Win32ProcessHandle methodsFor:'printing & storing'!
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 17683
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 17684
printOn:aStream
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 17685
    "return a printed representation of the receiver"
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 17686
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 17687
    super printOn:aStream.
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 17688
    aStream nextPutAll:' pid:'.
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 17689
    pid printOn:aStream.
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 17690
! !
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 17691
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17692
!Win32OperatingSystem::Win32SerialPortHandle methodsFor:'opening'!
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
open:portName baudRate:baudRate stopBitsType:stopBitsType
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17695
		    parityType:parityType dataBits:dataBits
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17696
		    inFlowCtrl:inFlowCtrlType outFlowCtrl:outFlowCtrlType
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17697
		    xOnChar:xOnChar xOffChar:xOffChar
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17698
    "portName: COM%d
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17699
     baudRate: Integer
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17700
     stopBitsType: #stop1, #stop2 or #stop1_5
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17701
     parityType: #odd, #even or #none
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17702
     dataBits: #integer
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17703
     inFlowCtrlType: #xOnOff #hardware
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17704
     outFlowCtrlType: #xOnOff #hardware
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17705
     xOnChar: Character or Integer
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17706
     xOffChar: Character or Integer"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17707
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17708
    |errorNumber|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17709
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17710
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17711
    HANDLE port;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17712
    COMMTIMEOUTS timeouts;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17713
    DCB dcb;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17714
    char *__portName;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17715
    int __setBaudRate = 1,
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17716
	__setDataBits = 1,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17717
	__setXOnChar = 1,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17718
	__setXOffChar = 1,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17719
	__setInFlowCtrl = 1,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17720
	__setOutFlowCtrl = 1,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17721
	__setStopBits = 1,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17722
	__setParityType = 1;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17723
    int __baudRate, __dataBits;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17724
    int __xOnChar, __xOffChar;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17725
    int __inFlowCtrl, __outFlowCtrl;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17726
    int __stopBits, __parityType;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17727
#   define XONOFF       1
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17728
#   define HARDWARE     2
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17729
#   define STOP1     1
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17730
#   define STOP2     2
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17731
#   define STOP1_5   3
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17732
#   define ODD       1
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17733
#   define EVEN      2
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17734
#   define NONE      3
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17735
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
 17736
    if (__isStringLike(portName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17737
	__portName = __stringVal(portName);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17738
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17739
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17740
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17741
    if (__isSmallInteger(baudRate)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17742
	__baudRate = __intVal(baudRate);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17743
    } else if (baudRate == nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17744
	__setBaudRate = 0;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17745
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17746
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17747
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17748
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17749
    if (__isSmallInteger(dataBits)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17750
	__dataBits = __intVal(dataBits);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17751
    } else if (dataBits == nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17752
	__setDataBits = 0;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17753
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17754
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17755
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17756
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17757
    if (__isSmallInteger(xOnChar)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17758
	__xOnChar = __intVal(xOnChar);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17759
    } else if (__isCharacter(xOnChar)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17760
	__xOnChar = __intVal(_characterVal(xOnChar));
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17761
    } else if (xOnChar == nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17762
	__setXOnChar = 0;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17763
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17764
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17765
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17766
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17767
    if (__isSmallInteger(xOffChar)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17768
	__xOffChar = __intVal(xOffChar);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17769
    } else if (__isCharacter(xOffChar)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17770
	__xOffChar = __intVal(_characterVal(xOffChar));
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17771
    } else if (xOffChar == nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17772
	__setXOffChar = 0;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17773
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17774
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17775
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17776
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17777
    if (inFlowCtrlType == @symbol(xOnOff)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17778
	__inFlowCtrl = XONOFF;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17779
    } else if (inFlowCtrlType == @symbol(hardware)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17780
	__inFlowCtrl = HARDWARE;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17781
    } else if (inFlowCtrlType == nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17782
	__setInFlowCtrl = 0;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17783
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17784
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17785
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17786
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17787
    if (outFlowCtrlType == @symbol(xOnOff)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17788
	__outFlowCtrl = XONOFF;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17789
    } else if (outFlowCtrlType == @symbol(hardware)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17790
	__outFlowCtrl = HARDWARE;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17791
    } else if (outFlowCtrlType == nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17792
	__setOutFlowCtrl = 0;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17793
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17794
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17795
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17796
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17797
    if (stopBitsType == @symbol(stop1)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17798
	__stopBits = STOP1;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17799
    } else if (stopBitsType == @symbol(stop2)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17800
	__stopBits = STOP2;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17801
    } else if (stopBitsType == @symbol(stop1_5)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17802
	__stopBits = STOP1_5;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17803
    } else if (stopBitsType == nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17804
	__setStopBits = 0;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17805
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17806
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17807
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17808
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17809
    port = CreateFile(__portName,
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17810
	      GENERIC_READ | GENERIC_WRITE,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17811
	      0,             /* comm devices must be opened with exclusive access */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17812
	      NULL,          /* no security attrs */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17813
	      OPEN_EXISTING, /* comm devices must use OPEN_EXISTING */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17814
	      0,             /* no overlapped I/O */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17815
	      NULL           /* hTemplate must be NULL for comm devices */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17816
	   );
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17817
    if (port == INVALID_HANDLE_VALUE) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17818
	console_fprintf(stderr, "Win32OS [info]: serial port open failed\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17819
	errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17820
	goto failure;
9156
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
    /* Flush the driver */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17823
    PurgeComm( port, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17824
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17825
    /* Set driver buffer sizes */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17826
    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
 17827
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17828
    /* Reset timeout constants */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17829
    timeouts.ReadIntervalTimeout= 0xFFFFFFFF;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17830
    timeouts.ReadTotalTimeoutMultiplier = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17831
    timeouts.ReadTotalTimeoutConstant = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17832
    timeouts.WriteTotalTimeoutMultiplier = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17833
    timeouts.WriteTotalTimeoutConstant = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17834
    SetCommTimeouts( port, &timeouts );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17835
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17836
    /* Set communication parameters */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17837
    ZeroMemory(&dcb, sizeof(dcb));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17838
    dcb.DCBlength = sizeof(dcb);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17839
    GetCommState(port, &dcb);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17840
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17841
    if (__setBaudRate) dcb.BaudRate = __baudRate;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17842
    if (__setDataBits) dcb.ByteSize = __dataBits;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17843
    if (__setXOnChar)  dcb.XonChar = __xOnChar;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17844
    if (__setXOffChar) dcb.XoffChar = __xOffChar;
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
    if (__setStopBits) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17847
	/* set stop bits */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17848
	switch(__stopBits) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17849
	    case STOP1_5: dcb.StopBits = 1; break; /* 1.5 stop bits */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17850
	    case STOP1: dcb.StopBits = 0; break; /* 1 stop bit */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17851
	    case STOP2: dcb.StopBits = 2; break; /* 2 stop bits */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17852
	    default: goto errExit;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17853
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17854
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17855
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17856
    if (__setParityType) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17857
	/* set parity */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17858
	switch(__parityType) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17859
	    case NONE: dcb.Parity = NOPARITY; break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17860
	    case ODD: dcb.Parity = ODDPARITY; break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17861
	    case EVEN: dcb.Parity = EVENPARITY; break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17862
	    default: goto errExit;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17863
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17864
    }
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
    if (__setInFlowCtrl) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17867
	/* set control flow */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17868
	dcb.fInX = FALSE;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17869
	dcb.fDtrControl = FALSE;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17870
	if (__inFlowCtrl == XONOFF) dcb.fInX = TRUE;  /* XOn/XOff handshaking */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17871
	if (__inFlowCtrl == HARDWARE) dcb.fDtrControl = TRUE;  /* hardware handshaking */
9156
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
    if (__setOutFlowCtrl) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17874
	dcb.fOutX = FALSE;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17875
	dcb.fOutxCtsFlow = FALSE;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17876
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17877
	if (__outFlowCtrl == XONOFF) dcb.fOutX = TRUE;  /* XOn/XOff handshaking */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17878
	if (__outFlowCtrl == HARDWARE) dcb.fOutxCtsFlow = TRUE;  /* hardware handshaking */
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17879
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17880
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17881
    if (SetCommState(port, &dcb)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17882
	RETURN( true );
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17883
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17884
10352
f2e9bb8906db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10342
diff changeset
 17885
    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
 17886
    errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17887
    /* fall into */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17888
errExit: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17889
    CloseHandle(port);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17890
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17891
failure: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17892
#   undef XONOFF
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17893
#   undef HARDWARE
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17894
#   undef STOP1
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17895
#   undef STOP2
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17896
#   undef STOP1_5
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17897
#   undef ODD
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17898
#   undef EVEN
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17899
#   undef NONE
9088
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 17900
%}.
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 17901
    errorNumber isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17902
	self error:'invalid argument(s)'.
9088
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 17903
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17904
	(OperatingSystem errorHolderForNumber:errorNumber) reportError
9088
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 17905
    ].
9156
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
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17908
!Win32OperatingSystem::Win32SerialPortHandle methodsFor:'release'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17909
16345
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 17910
closeHandle
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17911
    "close the handle"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17912
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17913
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17914
    HANDLE port = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17915
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17916
    if (port) {
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 17917
	__externalAddressVal(self) = (HANDLE)0;
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 17918
	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
 17919
	CloseHandle(port);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17920
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17921
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17922
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17923
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17924
!Win32OperatingSystem::Win32SerialPortHandle methodsFor:'setup'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17925
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17926
baudRate:newRate
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17927
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17928
    HANDLE port = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17929
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17930
    if (port
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17931
     && __isSmallInteger(newRate)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17932
	DCB dcb;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17933
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17934
	ZeroMemory(&dcb, sizeof(dcb));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17935
	dcb.DCBlength = sizeof(dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17936
	GetCommState(port, &dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17937
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17938
	dcb.BaudRate = __intVal(newRate);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17939
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17940
	if (! SetCommState(port, &dcb)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17941
	    RETURN(false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17942
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17943
	RETURN(true);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17944
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17945
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17946
    self primitiveFailed.
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
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17949
dataBits:newNumberOfBits
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
    HANDLE port = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17952
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17953
    if (port
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17954
     && __isSmallInteger(newNumberOfBits)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17955
	DCB dcb;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17956
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17957
	ZeroMemory(&dcb, sizeof(dcb));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17958
	dcb.DCBlength = sizeof(dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17959
	GetCommState(port, &dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17960
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17961
	dcb.ByteSize = __intVal(newNumberOfBits);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17962
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17963
	if (! SetCommState(port, &dcb)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17964
	    RETURN(false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17965
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17966
	RETURN(true);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17967
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17968
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17969
    self primitiveFailed.
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
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17972
parityType:newParityTypeSymbol
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17973
    "newParityTypeSymbol must be one of #odd, #even or #none (or nil)"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17974
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17975
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17976
    HANDLE port = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17977
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17978
    if (port) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17979
	DCB dcb;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17980
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17981
	ZeroMemory(&dcb, sizeof(dcb));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17982
	dcb.DCBlength = sizeof(dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17983
	GetCommState(port, &dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17984
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17985
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17986
	if ((newParityTypeSymbol == nil) || (newParityTypeSymbol == @symbol(none))) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17987
	    dcb.Parity = NOPARITY;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17988
	} else if (newParityTypeSymbol == @symbol(odd)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17989
	    dcb.Parity = ODDPARITY;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17990
	} else if (newParityTypeSymbol == @symbol(even)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17991
	    dcb.Parity = EVENPARITY;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17992
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17993
	    goto failure;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17994
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17995
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17996
	if (! SetCommState(port, &dcb)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17997
	    RETURN(false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17998
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17999
	RETURN(true);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18000
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18001
  failure: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18002
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18003
    self primitiveFailed.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18004
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18005
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18006
stopBitsType:newStopBitsSymbol
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18007
    "newParityTypeSymbol must be one of #stop1, #stop2 or #stop1_5"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18008
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18009
    HANDLE port = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18010
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18011
    if (port) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18012
	DCB dcb;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18013
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18014
	ZeroMemory(&dcb, sizeof(dcb));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18015
	dcb.DCBlength = sizeof(dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18016
	GetCommState(port, &dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18017
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18018
	if (newStopBitsSymbol == @symbol(stop1)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18019
	    dcb.Parity = 0 /* STOP1 */;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18020
	} else if (newStopBitsSymbol == @symbol(stop2)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18021
	    dcb.Parity = 2 /* STOP2 */;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18022
	} else if (newStopBitsSymbol == @symbol(stop1_5)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18023
	    dcb.Parity = 1 /* STOP1_5 */;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18024
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18025
	    goto failure;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18026
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18027
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18028
	if (! SetCommState(port, &dcb)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18029
	    RETURN(false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18030
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18031
	RETURN(true);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18032
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18033
  failure: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18034
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18035
    self primitiveFailed.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18036
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18037
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18038
!Win32OperatingSystem::Win32SocketHandle class methodsFor:'constants'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18039
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18040
protocolCodeOf:aNameOrNumber
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18041
    "q&d hack for unix-compatibility"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18042
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18043
    aNameOrNumber isNumber ifTrue:[^ aNameOrNumber].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18044
    aNameOrNumber isNil ifTrue:[^ aNameOrNumber].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18045
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18046
    aNameOrNumber = 'tcp' ifTrue:[^ 6].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18047
    aNameOrNumber = 'udp' ifTrue:[^ 17].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18048
    aNameOrNumber = 'raw' ifTrue:[^ 255].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18049
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18050
    self error:'unsupported protocol' mayProceed:true.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18051
    ^ nil.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18052
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18053
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18054
     self protocolCodeOf:#tcp
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18055
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18056
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18057
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18058
protocolSymbolOf:anInteger
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18059
    "q&d hack for unix-compatibility"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18060
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18061
    anInteger isNil ifTrue:[^ nil].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18062
    anInteger isSymbol ifTrue:[^ anInteger].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18063
14889
eaddf47af679 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14854
diff changeset
 18064
    anInteger ==   0 ifTrue:[ ^ #ip ].
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18065
    anInteger ==   6 ifTrue:[ ^ #tcp ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18066
    anInteger ==  17 ifTrue:[ ^ #udp ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18067
    anInteger == 255 ifTrue:[ ^ #raw ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18068
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18069
    self error:'unsupported protocol' mayProceed:true.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18070
    ^ nil.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18071
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18072
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18073
     self protocolSymbolOf:6
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 18074
    "
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 18075
! !
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 18076
16345
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18077
!Win32OperatingSystem::Win32SocketHandle class methodsFor:'instance creation'!
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18078
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18079
new
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18080
    "return an initialized instance"
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18081
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18082
    ^ self basicNew initialize.
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18083
! !
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18084
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 18085
!Win32OperatingSystem::Win32SocketHandle class methodsFor:'queries'!
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 18086
16289
78bd98e104bb class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16285
diff changeset
 18087
getAddressInfo:hostNameOrNil serviceName:serviceNameOrNil domain:domainArg type:typeArg protocol:protoArg flags:flags
78bd98e104bb class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16285
diff changeset
 18088
    "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
 18089
     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
 18090
     addresses to be returned."
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 18091
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18092
    |error errorString result domain type proto hostName serviceName port|
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18093
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18094
    domain := OperatingSystem domainCodeOf:domainArg.
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18095
    type := OperatingSystem socketTypeCodeOf:typeArg.
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18096
    proto := self protocolCodeOf:protoArg.
16289
78bd98e104bb class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16285
diff changeset
 18097
    serviceNameOrNil notNil ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18098
	serviceName := serviceNameOrNil printString.      "convert integer port numbers"
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18099
	serviceNameOrNil isInteger ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18100
	    port := serviceNameOrNil.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18101
	].
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 18102
    ]. "ifFalse:[serviceName := nil]"
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18103
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18104
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18105
%{
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18106
#if 1 || !defined(AI_NUMERICHOST)
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18107
%}.
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18108
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18109
    "have to convert serviceName and hostName to single byte strings
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18110
     until we implement getAddrInfoW() for Borland C.
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18111
     If we really have 16-bit hostnames, this fails with #primitiveFailed"
16289
78bd98e104bb class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16285
diff changeset
 18112
    hostNameOrNil notNil ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18113
	hostName := hostNameOrNil asSingleByteStringIfPossible.
16289
78bd98e104bb class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16285
diff changeset
 18114
    ].  "ifFalse:[hostName := nil] is nil anyway"
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18115
    serviceName notNil ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18116
	serviceName := serviceName asSingleByteStringIfPossible.
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18117
    ].
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18118
%{
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18119
#endif // !AI_NUMERICHOST
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18120
%}.
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18121
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18122
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18123
%{ /* STACK:32000 */
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18124
#if !defined(NO_SOCKET)
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18125
    char *__hostName, *__serviceName;
15580
4f1aa9df6162 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15547
diff changeset
 18126
    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
 18127
    int ret;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 18128
    int cnt = 0;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18129
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18130
    if (hostName == nil) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18131
	__hostName = 0;
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 18132
    } else if (__isStringLike(hostName)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18133
	strncpy(__hostNameCopy, __stringVal(hostName), sizeof(__hostNameCopy)-1);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18134
	__hostName = __hostNameCopy;
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18135
    } else if (__isUnicode16String(hostName)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18136
	error = @symbol(unsupportedUnicodeName);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18137
	errorString = __MKSTRING("Unicode hostnames are not yet supported");
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18138
	goto exitPrim;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18139
    } else {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18140
	error = @symbol(badArgument1);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18141
	goto exitPrim;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18142
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18143
    if (serviceName == nil) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18144
	__serviceName = 0;
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 18145
    } else if (__isStringLike(serviceName)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18146
	strncpy(__serviceNameCopy, __stringVal(serviceName), sizeof(__serviceNameCopy)-1);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18147
	__serviceName = __serviceNameCopy;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18148
    } else {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18149
	error = @symbol(badArgument2);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18150
	goto exitPrim;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18151
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18152
    if (__hostName == 0 && __serviceName == 0) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18153
	error = @symbol(badArgument);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18154
	goto exitPrim;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18155
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18156
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18157
{
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18158
# if defined(AI_NUMERICHOST)
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18159
    /*
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18160
     * Use getaddrinfo()
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
    struct addrinfo hints;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18163
    struct addrinfo *info = NULL, *infop;
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
    memset(&hints, 0, sizeof(hints));
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18166
    if (__isSmallInteger(domain))
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18167
	hints.ai_family = __intVal(domain);
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18168
    if (__isSmallInteger(type))
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18169
	hints.ai_socktype = __intVal(type);
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18170
    if (__isSmallInteger(proto))
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18171
	hints.ai_protocol = __intVal(proto);
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18172
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18173
    do {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18174
# ifdef DO_WRAP_CALLS
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18175
	do {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18176
	    __threadErrno = 0;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18177
	    // 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
 18178
	    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
 18179
	} while ((ret < 0) && (__threadErrno == EINTR));
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18180
# else
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18181
	__BEGIN_INTERRUPTABLE__
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18182
	ret = getaddrinfo(__hostName, __serviceName, &hints, &info);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18183
	__END_INTERRUPTABLE__
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18184
# endif
14852
f8cf16374fd5 Fix getnameinfo() and getaddrinfo() #ifdefed code
Stefan Vogel <sv@exept.de>
parents: 14849
diff changeset
 18185
    } while (ret != 0 && __threadErrno == EINTR);
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18186
    if (ret != 0) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18187
	switch (ret) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18188
	case EAI_FAMILY:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18189
	    error = @symbol(badProtocol);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18190
	    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18191
	case EAI_SOCKTYPE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18192
	    error = @symbol(badSocketType);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18193
	    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18194
	case EAI_BADFLAGS:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18195
	    error = @symbol(badFlags);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18196
	    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18197
	case EAI_NONAME:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18198
	    error = @symbol(unknownHost);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18199
	    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18200
	case EAI_SERVICE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18201
	    error = @symbol(unknownService);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18202
	    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18203
	case EAI_MEMORY:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18204
	    error = @symbol(allocationFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18205
	    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18206
	case EAI_FAIL:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18207
	    error = @symbol(permanentFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18208
	    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18209
	case EAI_AGAIN:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18210
	    error = @symbol(tryAgain);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18211
	    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18212
	default:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18213
	    error = @symbol(unknownError);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18214
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18215
	errorString = __MKSTRING(gai_strerror(ret));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18216
	goto err;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18217
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18218
    for (cnt=0, infop=info; infop; infop=infop->ai_next)
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18219
	cnt++;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18220
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18221
    result = __ARRAY_NEW_INT(cnt);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18222
    if (result == nil) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18223
	error = @symbol(allocationFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18224
	goto err;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18225
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18226
    for (infop=info, cnt=0; infop; infop=infop->ai_next, cnt++) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18227
	OBJ o, resp;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18228
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18229
	resp = __ARRAY_NEW_INT(6);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18230
	if (resp == nil) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18231
	    error = @symbol(allocationFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18232
	    goto err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18233
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18234
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18235
	__ArrayInstPtr(result)->a_element[cnt] = resp; __STORE(result, resp);
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
	__ArrayInstPtr(resp)->a_element[0] = __mkSmallInteger(infop->ai_flags);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18238
	__ArrayInstPtr(resp)->a_element[1] = __mkSmallInteger(infop->ai_family);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18239
	__ArrayInstPtr(resp)->a_element[2] = __mkSmallInteger(infop->ai_socktype);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18240
	__ArrayInstPtr(resp)->a_element[3] = __mkSmallInteger(infop->ai_protocol);
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
	__PROTECT__(resp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18243
	o = __BYTEARRAY_NEW_INT(infop->ai_addrlen);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18244
	__UNPROTECT__(resp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18245
	if (o == nil) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18246
	    error = @symbol(allocationFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18247
	    goto err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18248
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18249
	memcpy(__byteArrayVal(o), infop->ai_addr, infop->ai_addrlen);
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18250
       __ArrayInstPtr(resp)->a_element[4] = o; __STORE(resp, o);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18251
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18252
	if (infop->ai_canonname) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18253
	    __PROTECT__(resp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18254
	    o = __MKSTRING(infop->ai_canonname);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18255
	    __UNPROTECT__(resp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18256
	    if (o == nil) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18257
		error = @symbol(allocationFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18258
		goto err;
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
	    __ArrayInstPtr(resp)->a_element[5] = o; __STORE(resp, o);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18261
	}
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18262
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18263
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18264
err:
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18265
    if (info) freeaddrinfo(info);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18266
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18267
# else /* ! AI_NUMERICHOST =============================================================*/
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18268
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18269
    /*
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18270
     * Use getservbyname() / gethostByName()
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18271
     */
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18272
    struct hostent *hp;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18273
    char **addrpp;
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 18274
    int __port = 0;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18275
    int i;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18276
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 18277
    if (__isSmallInteger(port)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18278
	__port = htons(__smallIntegerVal(port));
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 18279
    } else if (__serviceName) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18280
	struct servent *sp;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18281
	char *__proto = 0;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18282
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18283
	if (__isStringLike(protoArg))
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18284
	    __proto = __stringVal(protoArg);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18285
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18286
	sp = getservbyname(__serviceName, __proto);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18287
	if (sp == NULL) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18288
	    __port = atoi(__serviceName);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18289
	    if (__port <= 0) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18290
		errorString = @symbol(unknownService);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18291
		error = __mkSmallInteger(-3);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18292
		goto err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18293
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18294
	    __port = htons(__port);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18295
	} else
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18296
	    __port = sp->s_port;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18297
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18298
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18299
    if (__hostName) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18300
	int err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18301
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18302
	do {
15604
86e0ba23123f class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15598
diff changeset
 18303
# if 0 && defined(DO_WRAP_CALLS)
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18304
	    /* This does not work - the structure is allocated in thread local storage */
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18305
	    hp = STX_WSA_NOINT_CALL1("gethostbyname", gethostbyname, __hostName);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18306
	    if ((INT)hp < 0) hp = NULL;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18307
# else
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18308
	    /* __BEGIN_INTERRUPTABLE__ is dangerous, because gethostbyname
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18309
	     * uses a static data area, but allocates it in thread local storage
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18310
	     */
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18311
	    // __BEGIN_INTERRUPTABLE__
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18312
	    hp = gethostbyname(__hostName);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18313
	    // __END_INTERRUPTABLE__
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18314
#endif
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18315
	} while ((hp == NULL
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18316
		  && (err = WSAGetLastError()) == EINTR));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18317
	if (hp == 0) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18318
	    switch (err) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18319
	    case HOST_NOT_FOUND:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18320
		errorString = @symbol(unknownHost);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18321
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18322
	    case NO_ADDRESS:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18323
		errorString = @symbol(noAddress);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18324
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18325
	    case NO_RECOVERY:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18326
		errorString = @symbol(permanentFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18327
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18328
	    case TRY_AGAIN:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18329
		errorString = @symbol(tryAgain);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18330
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18331
	    default:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18332
		errorString = @symbol(unknownError);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18333
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18334
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18335
	    error = __mkSmallInteger(err);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18336
	    goto err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18337
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18338
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18339
	if (__isSmallInteger(domain) && hp->h_addrtype != __smallIntegerVal(domain)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18340
	    errorString = @symbol(unknownHost);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18341
	    error = __mkSmallInteger(-2);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18342
	    goto err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18343
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18344
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18345
	for (cnt = 0, addrpp = hp->h_addr_list; *addrpp; addrpp++)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18346
	    cnt++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18347
	addrpp = hp->h_addr_list;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18348
    } else {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18349
	cnt = 1;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18350
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18351
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18352
    result = __ARRAY_NEW_INT(cnt);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18353
    if (result == nil) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18354
	error = @symbol(allocationFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18355
	goto err;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18356
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18357
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18358
    for (i = 0; i < cnt; i++) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18359
	OBJ o, resp;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18360
	struct sockaddr_in *sa;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18361
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18362
	resp = __ARRAY_NEW_INT(6);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18363
	if (resp == nil) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18364
	    error = @symbol(allocationFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18365
	    goto err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18366
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18367
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18368
	__ArrayInstPtr(result)->a_element[i] = resp; __STORE(result, resp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18369
	__ArrayInstPtr(resp)->a_element[0] = __mkSmallInteger(0);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18370
	__ArrayInstPtr(resp)->a_element[2] = type; __STORE(resp, type);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18371
	__ArrayInstPtr(resp)->a_element[3] = proto; __STORE(resp, proto);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18372
	__PROTECT__(resp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18373
	o = __BYTEARRAY_NEW_INT(sizeof(*sa));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18374
	__UNPROTECT__(resp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18375
	if (o == nil) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18376
	    error = @symbol(allocationFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18377
	    goto err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18378
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18379
	__ArrayInstPtr(resp)->a_element[4] = o; __STORE(resp, o);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18380
	sa = (struct sockaddr_in *)__byteArrayVal(o);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18381
	sa->sin_port = __port;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18382
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18383
	if (__hostName) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18384
	    sa->sin_family = hp->h_addrtype;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18385
	    memcpy(&sa->sin_addr, *addrpp, hp->h_length);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18386
	    __ArrayInstPtr(resp)->a_element[1] = __mkSmallInteger(hp->h_addrtype);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18387
	    if (hp->h_name) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18388
		__PROTECT__(resp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18389
		o = __MKSTRING(hp->h_name);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18390
		__UNPROTECT__(resp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18391
		if (o == nil) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18392
		    error = @symbol(allocationFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18393
		    goto err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18394
		}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18395
		__ArrayInstPtr(resp)->a_element[5] = o; __STORE(resp, o);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18396
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18397
	    addrpp++;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18398
	} else{
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18399
	    if (__isSmallInteger(domain))
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18400
		sa->sin_family = __intVal(domain);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18401
	    else
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18402
		sa->sin_family = AF_INET;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18403
	    __ArrayInstPtr(resp)->a_element[1] = domain; __STORE(resp, domain);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18404
	}
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18405
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18406
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18407
err:;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18408
# endif /* ! AI_NUMERICHOST */
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18409
}
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18410
#else /* ! HAS_SOCKET */
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18411
    error = @symbol(notImplemented);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18412
#endif
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 18413
exitPrim:;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18414
%}.
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18415
    error notNil ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18416
	|request|
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18417
	request := SocketAddressInfo new
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18418
	    domain:domainArg;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18419
	    type:typeArg;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18420
	    protocol:protoArg;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18421
	    canonicalName:hostName;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18422
	    serviceName:serviceName.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18423
	^ (HostNameLookupError new
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18424
		parameter:error;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18425
		messageText:' - ', (errorString ? error printString);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18426
		request:request) raiseRequest.
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 18427
    ].
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18428
    1 to:result size do:[:i |
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18429
	|entry dom info|
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18430
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18431
	info := SocketAddressInfo new.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18432
	entry := result at:i.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18433
	info flags:(entry at:1).
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18434
	info domain:(dom := OperatingSystem domainSymbolOf:(entry at:2)).
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18435
	info type:(OperatingSystem socketTypeSymbolOf:(entry at:3)).
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18436
	info protocol:(self protocolSymbolOf:(entry at:4)).
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18437
	info socketAddress:((SocketAddress newDomain:dom) fromBytes:(entry at:5)).
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18438
	info canonicalName:(entry at:6).
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18439
	result at:i put:info
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 18440
    ].
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18441
    ^ result
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18442
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18443
    "
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18444
     self getAddressInfo:'localhost' serviceName:nil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18445
	    domain:nil type:nil protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18446
     self getAddressInfo:'localhost' serviceName:nil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18447
	    domain:#AF_INET type:#stream protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18448
     self getAddressInfo:'localhost' serviceName:nil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18449
	    domain:#AF_INET type:#stream protocol:#tcp flags:nil
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 18450
     self getAddressInfo:'localhost' serviceName:10
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18451
	    domain:#AF_INET type:#stream protocol:#tcp flags:nil
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 18452
     self getAddressInfo:'localhost' serviceName:'10'
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18453
	    domain:#AF_INET type:#stream protocol:#tcp flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18454
     self getAddressInfo:'blurb.exept.de' serviceName:nil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18455
	    domain:#AF_INET type:nil protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18456
     self getAddressInfo:'1.2.3.4' serviceName:'bla'
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18457
	    domain:#AF_INET type:nil protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18458
     self getAddressInfo:'localhost' serviceName:'echo'
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18459
	    domain:#AF_INET type:nil protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18460
     self getAddressInfo:nil serviceName:'echo'
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18461
	    domain:#AF_INET type:nil protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18462
     self getAddressInfo:nil serviceName:nil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18463
	    domain:#AF_INET type:nil protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18464
     self getAddressInfo:'www.google.de' serviceName:nil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18465
	    domain:nil type:nil protocol:nil flags:nil
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18466
     self getAddressInfo:'exeptn' serviceName:nil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18467
	    domain:nil type:nil protocol:nil flags:nil
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18468
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18469
     self getAddressInfo:'localhost' asUnicode16String serviceName:nil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18470
	    domain:nil type:nil protocol:nil flags:nil
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18471
     self getAddressInfo:'ützlbrützl' serviceName:nil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18472
	    domain:nil type:nil protocol:nil flags:nil
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18473
     self getAddressInfo:'ützlbrützl' serviceName:nil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18474
	    domain:nil type:nil protocol:nil flags:nil
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 18475
     self getAddressInfo:'путин.ру' asUnicode16String serviceName:nil
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18476
	    domain:nil type:nil protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 18477
    "
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18478
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18479
17595
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18480
getNameInfo:socketAddressIn wantHostName:wantHostName wantServiceName:wantServiceName datagram:useDatagram flags:flags
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18481
    "answer an Array containing the hostName and serviceName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18482
     in socketAddress.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18483
     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
 18484
     this returns multiple hostnames (if appropriate)"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18485
17595
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18486
    |socketAddress error errorString hostName serviceName|
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18487
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18488
    socketAddress := socketAddressIn.
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18489
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18490
%{   /* STACK:32000 */
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18491
#if !defined(NI_NUMERICHOST)
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18492
%}.
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18493
    "if the getNameInfo() syscall is not present (as in Borland),
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18494
     convert mapped IPv4 to IPv6Addresses back to IPv4,
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18495
     so that these addresses can be resolved"
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18496
    socketAddress := socketAddress asIPv4SocketAddressIfPossible.
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18497
%{
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18498
#endif // !defined(NI_NUMERICHOST)
3a744321aa74 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17594
diff changeset
 18499
%}.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18500
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18501
%{  /* STACK:32000 */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18502
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18503
#if !defined(NO_SOCKET)
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18504
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18505
# ifndef NI_MAXHOST
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18506
#  define NI_MAXHOST 256
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18507
#  define NI_MAXSERV 64
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18508
# endif
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18509
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18510
    char host[NI_MAXHOST];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18511
    char service[NI_MAXSERV];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18512
    char *hp = 0, *sp = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18513
    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
 18514
    int ret;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 18515
    int __flags;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18516
    char *bp;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18517
    int nInstBytes, sockAddrSize;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18518
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18519
    if (wantHostName == true) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18520
	hp = host;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18521
	hsz = sizeof(host);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18522
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18523
    if (wantServiceName == true) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18524
	sp = service;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18525
	ssz = sizeof(service);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18526
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18527
    if (hp == 0 && sp == 0) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18528
	error = @symbol(badArgument);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18529
	goto err;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18530
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18531
    if (!__isBytes(socketAddress)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18532
	error = @symbol(badArgument1);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18533
	goto err;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18534
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18535
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18536
    nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(socketAddress))->c_ninstvars));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18537
    sockAddrSize = __byteArraySize(socketAddress);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18538
    sockAddrSize -= nInstBytes;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18539
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18540
    if (!__isSmallInteger(flags)) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18541
	error = @symbol(badArgument5);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18542
	goto err;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18543
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18544
    __flags = __intVal(flags);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18545
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18546
#if defined(NI_NUMERICHOST)
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18547
    if (useDatagram == true) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18548
	__flags |= NI_DGRAM;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18549
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18550
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18551
    {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18552
	bp = (char *)(__byteArrayVal(socketAddress));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18553
	bp += nInstBytes;
14852
f8cf16374fd5 Fix getnameinfo() and getaddrinfo() #ifdefed code
Stefan Vogel <sv@exept.de>
parents: 14849
diff changeset
 18554
# ifdef DO_WRAP_CALLS
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18555
	do {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18556
	    __threadErrno = 0;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18557
	    // do not cast to INT - will loose sign bit then!
19339
8d679a172fab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 19338
diff changeset
 18558
	    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
 18559
	} while ((ret < 0) && (__threadErrno == EINTR));
14852
f8cf16374fd5 Fix getnameinfo() and getaddrinfo() #ifdefed code
Stefan Vogel <sv@exept.de>
parents: 14849
diff changeset
 18560
# else
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18561
	__BEGIN_INTERRUPTABLE__
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18562
	ret = getnameinfo((struct sockaddr *)bp, sockAddrSize,
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18563
			  hp, hsz, sp, ssz, __flags);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18564
	__END_INTERRUPTABLE__
14852
f8cf16374fd5 Fix getnameinfo() and getaddrinfo() #ifdefed code
Stefan Vogel <sv@exept.de>
parents: 14849
diff changeset
 18565
# endif
f8cf16374fd5 Fix getnameinfo() and getaddrinfo() #ifdefed code
Stefan Vogel <sv@exept.de>
parents: 14849
diff changeset
 18566
    } while (ret != 0 && __threadErrno == EINTR);
f8cf16374fd5 Fix getnameinfo() and getaddrinfo() #ifdefed code
Stefan Vogel <sv@exept.de>
parents: 14849
diff changeset
 18567
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18568
    if (ret != 0) {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18569
	switch (ret) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18570
	    case EAI_FAMILY:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18571
		error = @symbol(badProtocol);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18572
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18573
	    case EAI_SOCKTYPE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18574
		error = @symbol(badSocketType);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18575
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18576
	    case EAI_BADFLAGS:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18577
		error = @symbol(badFlags);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18578
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18579
	    case EAI_NONAME:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18580
		error = @symbol(unknownHost);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18581
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18582
	    case EAI_SERVICE:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18583
		error = @symbol(unknownService);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18584
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18585
	    case EAI_MEMORY:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18586
		error = @symbol(allocationFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18587
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18588
	    case EAI_FAIL:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18589
		error = @symbol(permanentFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18590
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18591
	    case EAI_AGAIN:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18592
		error = @symbol(tryAgain);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18593
		break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18594
	    default:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18595
		error = @symbol(unknownError);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18596
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18597
	errorString = __MKSTRING(gai_strerror(ret));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18598
	goto err;
9156
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
# else /* ! NI_NUMERICHOST */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18601
    {
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18602
	/*
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18603
	 * Do it using gethostbyaddr()
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18604
	 */
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18605
	struct sockaddr_in *sa;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18606
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18607
	if (sockAddrSize < sizeof(*sa)) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18608
	    error = @symbol(badArgument1);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18609
	    goto err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18610
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18611
	bp = (char *)(__byteArrayVal(socketAddress));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18612
	bp += nInstBytes;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18613
	sa = (struct sockaddr_in *)bp;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18614
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18615
	if (sp) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18616
	    struct servent *servp;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18617
	    char *__proto = 0;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18618
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18619
	    __proto = (useDatagram == true ? "udp" : "tcp");
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18620
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18621
	    servp = getservbyport(sa->sin_port, __proto);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18622
	    if (servp) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18623
		sp = servp->s_name;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18624
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18625
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18626
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18627
	if (sa->sin_family == AF_INET6) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18628
	    if (sp)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18629
		serviceName = __MKSTRING(sp);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18630
	    error = @symbol(AF_INET6);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18631
	    goto err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18632
	}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18633
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18634
	if (hp) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18635
	    struct hostent *hostp;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18636
	    int err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18637
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18638
	    do {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18639
		/* must refetch in loop */
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18640
		bp = (char *)(__byteArrayVal(socketAddress));
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18641
		bp += nInstBytes;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18642
		sa = (struct sockaddr_in *)bp;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18643
		/* __BEGIN_INTERRUPTABLE__ is dangerous, because gethostbyname uses a static data area
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18644
		 */
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18645
		hostp = gethostbyaddr((char *)&sa->sin_addr, sockAddrSize, sa->sin_family);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18646
		/* __END_INTERRUPTABLE__ */
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18647
	    } while ((hostp == NULL)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18648
		      && ((err = WSAGetLastError()) == EINTR)
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18649
	    );
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18650
	    if (hostp == 0) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18651
		switch (err) {
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18652
		case HOST_NOT_FOUND:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18653
		    errorString = @symbol(unknownHost);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18654
		    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18655
		case NO_ADDRESS:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18656
		    errorString = @symbol(noAddress);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18657
		    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18658
		case NO_RECOVERY:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18659
		    errorString = @symbol(permanentFailure);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18660
		    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18661
		case TRY_AGAIN:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18662
		    errorString = @symbol(tryAgain);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18663
		    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18664
		default:
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18665
		    errorString = @symbol(unknownError);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18666
		    break;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18667
		}
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18668
		error = __mkSmallInteger(err);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18669
		goto err;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18670
	    }
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18671
	    hp = hostp->h_name;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18672
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18673
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18674
# endif /* ! NI_NUMERICHOST */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18675
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18676
    if (hp)
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18677
	hostName = __MKSTRING(hp);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18678
    if (sp)
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18679
	serviceName = __MKSTRING(sp);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18680
err:;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18681
#else
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18682
    error = @symbol(notImplemented);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18683
#endif
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18684
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18685
    error notNil ifTrue:[
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18686
	(error == #AF_INET6 or:[errorString == #noAddress]) ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18687
	    "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
 18688
	     the getNetByAddr() syscall is not supported"
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18689
	    ^ Array
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18690
		with:socketAddress hostAddressString
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18691
		with:serviceName.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18692
	].
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18693
	error isSymbol ifTrue:[
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18694
	    self primitiveFailed:error.
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18695
	].
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18696
	^ (HostAddressLookupError new
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18697
		parameter:error;
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18698
		messageText:' - ', (errorString ? error printString);
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18699
		request:thisContext message) raiseRequest.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18700
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18701
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18702
    ^ Array with:hostName with:serviceName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18703
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18704
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18705
     self getNameInfo:
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18706
	(self getAddressInfo:'localhost' serviceName:'echo'
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18707
		domain:#AF_INET type:#stream protocol:nil flags:nil) first socketAddress
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18708
	 wantHostName:true wantServiceName:true datagram:false flags:0
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18709
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18710
     self getNameInfo:
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18711
	(self getAddressInfo:'exept.exept.de' serviceName:'echo'
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18712
		domain:#AF_INET type:#stream protocol:nil flags:nil) first socketAddress
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18713
	 wantHostName:true wantServiceName:true datagram:false flags:0
15604
86e0ba23123f class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15598
diff changeset
 18714
86e0ba23123f class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15598
diff changeset
 18715
     self getNameInfo:(IPSocketAddress hostAddress:#[1 2 3 4])
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18716
	 wantHostName:true wantServiceName:true datagram:false flags:0
17594
1f6f1ece1bb0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17521
diff changeset
 18717
1f6f1ece1bb0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 17521
diff changeset
 18718
     self getNameInfo:(IPv6SocketAddress localHost port:21)
19269
1089087bca33 mingw stuff
Claus Gittinger <cg@exept.de>
parents: 19174
diff changeset
 18719
	 wantHostName:true wantServiceName:true datagram:false flags:0
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 18720
    "
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 18721
! !
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 18722
16345
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18723
!Win32OperatingSystem::Win32SocketHandle methodsFor:'initialization'!
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18724
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18725
initialize
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18726
%{ /* NOCONTEXT */
18548
1a1879f23a05 Mingw fixes
Stefan Vogel <sv@exept.de>
parents: 18543
diff changeset
 18727
	__ExternalAddressInstPtr(self)->e_address = (void *)(INVALID_SOCKET);
16345
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18728
%}
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18729
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18730
    "
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18731
      self new
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18732
      self new isValid
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18733
    "
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18734
! !
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18735
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18736
!Win32OperatingSystem::Win32SocketHandle methodsFor:'queries'!
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18737
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18738
handleType
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 18739
    ^ #socketHandle
16345
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18740
!
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18741
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18742
isValid
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18743
%{  /* NOCONTEXT */
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18744
    SOCKET sock = (SOCKET)(__externalAddressVal(self));
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18745
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18746
    RETURN(sock == INVALID_SOCKET ? false : true);
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18747
%}.
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18748
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18749
    "
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18750
      self new isValid
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18751
    "
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18752
! !
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18753
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18754
!Win32OperatingSystem::Win32SocketHandle methodsFor:'release'!
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18755
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18756
closeHandle
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18757
    "close the handle"
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18758
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18759
%{ /* NOCONTEXT */
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18760
    SOCKET sock = (SOCKET)(__externalAddressVal(self));
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18761
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18762
    if (sock != INVALID_SOCKET) {
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 18763
	__externalAddressVal(self) = (void *)(INVALID_SOCKET);
16367
e08c79499faa Win32 sockets use handles instead of file pointers
Stefan Vogel <sv@exept.de>
parents: 16345
diff changeset
 18764
	closesocket(sock);
16345
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18765
    }
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18766
%}.
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18767
! !
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18768
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18769
!Win32OperatingSystem::Win32SocketHandle methodsFor:'testing'!
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18770
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18771
isSocketHandle
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18772
    ^ true
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18773
! !
575c1bf534c6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16337
diff changeset
 18774
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18775
!Win32OperatingSystem::WinPointStructure class methodsFor:'instance creation'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18776
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18777
new
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18778
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18779
^super new: self sizeInBytes
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18780
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18781
    "Created: / 03-08-2006 / 10:37:59 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18782
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18783
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 18784
sizeInBytes
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18785
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18786
^8
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18787
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18788
    "Created: / 03-08-2006 / 10:38:06 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18789
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18790
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18791
!Win32OperatingSystem::WinPointStructure methodsFor:'accessing'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18792
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18793
asPoint
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18794
	"Private - Answer the receiver as a Point."
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18795
    ^self x @ self y
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18796
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18797
    "Created: / 03-08-2006 / 10:45:55 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18798
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18799
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18800
x
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18801
	"Private - Answer the x coordinate of the point."
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18802
    ^self longAt: 0 + 1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18803
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18804
    "Created: / 03-08-2006 / 10:46:11 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18805
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18806
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18807
x: anInteger
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18808
	"Private - Set the x coordinate of the point."
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18809
    self longAt: 0 + 1 put: anInteger
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18810
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18811
    "Created: / 03-08-2006 / 10:46:41 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18812
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18813
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18814
y
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18815
	"Private - Answer the y coordinate of the point."
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18816
    ^self longAt: 4 + 1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18817
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18818
    "Created: / 03-08-2006 / 10:46:26 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18819
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18820
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18821
y: anInteger
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18822
	"Private - Set the y coordinate of the point."
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18823
    self longAt: 4 + 1 put: anInteger
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18824
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18825
    "Created: / 03-08-2006 / 10:46:56 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18826
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18827
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18828
!Win32OperatingSystem::WinPointStructure methodsFor:'printing'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18829
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18830
printOn: aStream
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 18831
	"Append a textual representation of the receiver to aStream."
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18832
    aStream nextPutAll: self class name, ' { ', self asPoint printString, ' } '
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18833
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18834
    "Created: / 03-08-2006 / 10:45:40 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18835
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 18836
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 18837
!Win32OperatingSystem class methodsFor:'documentation'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 18838
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 18839
version
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 18840
    ^ '$Header$'
12154
646c4171f0d2 added: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 11920
diff changeset
 18841
!
646c4171f0d2 added: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 11920
diff changeset
 18842
646c4171f0d2 added: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 11920
diff changeset
 18843
version_CVS
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 18844
    ^ '$Header$'
13618
9af72c855037 Fixes for #canExecuteCommand:
vrany
parents: 13616
diff changeset
 18845
!
9af72c855037 Fixes for #canExecuteCommand:
vrany
parents: 13616
diff changeset
 18846
9af72c855037 Fixes for #canExecuteCommand:
vrany
parents: 13616
diff changeset
 18847
version_SVN
18543
fef08f652ef8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18414
diff changeset
 18848
    ^ '$Id$'
13618
9af72c855037 Fixes for #canExecuteCommand:
vrany
parents: 13616
diff changeset
 18849
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 18850
! !
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 18851
14730
a4cc809df4f1 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14667
diff changeset
 18852
5135
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 18853
Win32OperatingSystem initialize!
17630
918d3b1dde77 Added #getObjectFileInfoFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17619
diff changeset
 18854
Win32OperatingSystem::PECOFFConstants initialize!
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 18855
Win32OperatingSystem::PerformanceData initialize!
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 18856
Win32OperatingSystem::RegistryEntry initialize!