Win32OperatingSystem.st
author Stefan Vogel <sv@exept.de>
Thu, 10 Apr 2014 10:54:27 +0200
changeset 16309 6df7a4841fb6
parent 16303 aad4b514271c
child 16315 b08c60b1588d
permissions -rw-r--r--
class: Win32OperatingSystem added: #selectOnAnyReadable:writable:exception:readableInto:writableInto:exceptionInto:withTimeOut:
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
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    17
AbstractOperatingSystem subclass:#Win32OperatingSystem
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    18
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    19
	classVariableNames:'Initialized HostName DomainName CurrentDirectory'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    20
	poolDictionaries:'Win32Constants'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    21
	category:'OS-Windows'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    22
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    23
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
    24
ByteArray variableByteSubclass:#DevModeStructure
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    25
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    26
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    27
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    28
	privateIn:Win32OperatingSystem
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
    29
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
    30
c57956a348bf printing support
fm
parents: 9431
diff changeset
    31
ByteArray variableByteSubclass:#DocInfoStructure
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    32
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    33
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    34
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    35
	privateIn:Win32OperatingSystem
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
    36
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
    37
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
    38
Object subclass:#FileStatusInfo
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    39
	instanceVariableNames:'type mode uid gid size id accessed modified created statusChanged
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    40
		sourcePath linkTargetPath fullPathName alternativePathName'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    41
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    42
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    43
	privateIn:Win32OperatingSystem
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    44
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    45
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    46
Object subclass:#OSProcessStatus
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    47
	instanceVariableNames:'pid status code core'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    48
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    49
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    50
	privateIn:Win32OperatingSystem
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    51
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    52
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
    53
Object subclass:#PerformanceData
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    54
	instanceVariableNames:'objectArray perfTime perfFreq perfTime100nSec'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    55
	classVariableNames:'PerformanceText CounterIndexTextDictionary
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    56
		HelpIndexTextDictionary'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    57
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    58
	privateIn:Win32OperatingSystem
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
    59
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
    60
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
    61
Object subclass:#Abstract
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    62
	instanceVariableNames:'lastData lastTimestamp cachedResults'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    63
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    64
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    65
	privateIn:Win32OperatingSystem::PerformanceData
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
    66
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
    67
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
    68
Win32OperatingSystem::PerformanceData::Abstract subclass:#DiskIO
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    69
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    70
	classVariableNames:'TheOneAndOnlyInstance'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    71
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    72
	privateIn:Win32OperatingSystem::PerformanceData
10688
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
    73
!
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
    74
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
    75
Win32OperatingSystem::PerformanceData::Abstract subclass:#Global
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    76
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    77
	classVariableNames:'TheOneAndOnlyInstance'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    78
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    79
	privateIn:Win32OperatingSystem::PerformanceData
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
    80
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
    81
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
    82
Win32OperatingSystem::PerformanceData::Abstract subclass:#Memory
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    83
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    84
	classVariableNames:'TheOneAndOnlyInstance'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    85
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    86
	privateIn:Win32OperatingSystem::PerformanceData
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
    87
!
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
    88
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
    89
Win32OperatingSystem::PerformanceData::Abstract subclass:#Network
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    90
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    91
	classVariableNames:'TheOneAndOnlyInstance'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    92
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    93
	privateIn:Win32OperatingSystem::PerformanceData
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
    94
!
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
    95
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
    96
Win32OperatingSystem::PerformanceData::Abstract subclass:#Process
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    97
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    98
	classVariableNames:'TheOneAndOnlyInstance'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
    99
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   100
	privateIn:Win32OperatingSystem::PerformanceData
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
   101
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
   102
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
   103
Win32OperatingSystem::PerformanceData::Abstract subclass:#Processor
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   104
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   105
	classVariableNames:'TheOneAndOnlyInstance'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   106
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   107
	privateIn:Win32OperatingSystem::PerformanceData
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
   108
!
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
   109
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
   110
ByteArray variableByteSubclass:#PrinterInfo2Structure
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   111
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   112
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   113
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   114
	privateIn:Win32OperatingSystem
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
   115
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
   116
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
   117
Object subclass:#RegistryEntry
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   118
	instanceVariableNames:'path handle'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   119
	classVariableNames:'Lobby HKEY_CLASSES_ROOT HKEY_CURRENT_USER HKEY_LOCAL_MACHINE
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   120
		HKEY_USERS HKEY_PERFORMANCE_DATA HKEY_CURRENT_CONFIG
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   121
		HKEY_DYN_DATA HKEY_PERFORMANCE_TEXT HKEY_PERFORMANCE_NLSTEXT'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   122
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   123
	privateIn:Win32OperatingSystem
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   124
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   125
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
   126
ByteArray variableByteSubclass:#TextMetricsStructure
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   127
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   128
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   129
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   130
	privateIn:Win32OperatingSystem
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
   131
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
   132
9100
0ebdc95e88ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9094
diff changeset
   133
OSHandle subclass:#Win32IOHandle
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   134
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   135
	classVariableNames:'Lobby'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   136
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   137
	privateIn:Win32OperatingSystem
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
   138
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
   139
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   140
Win32Handle subclass:#Win32NetworkResourceHandle
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   141
	instanceVariableNames:''
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   142
	classVariableNames:'ScopeMappingTable TypeMappingTable DisplayTypeMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   143
		UsageMappingTable'
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   144
	poolDictionaries:''
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   145
	privateIn:Win32OperatingSystem
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   146
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   147
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   148
Object subclass:#NetworkResource
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   149
	instanceVariableNames:'scope type usage displayType remoteName localName provider
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   150
		comment'
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   151
	classVariableNames:''
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   152
	poolDictionaries:''
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   153
	privateIn:Win32OperatingSystem::Win32NetworkResourceHandle
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   154
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
   155
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
   156
Win32Handle subclass:#Win32PrinterHandle
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   157
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   158
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   159
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   160
	privateIn:Win32OperatingSystem
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
   161
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
   162
9255
fded804fe4e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9249
diff changeset
   163
Win32Handle subclass:#Win32ProcessHandle
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   164
	instanceVariableNames:'pid'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   165
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   166
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   167
	privateIn:Win32OperatingSystem
7645
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
   168
!
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
   169
9100
0ebdc95e88ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9094
diff changeset
   170
Win32OperatingSystem::Win32IOHandle subclass:#Win32SerialPortHandle
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   171
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   172
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   173
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   174
	privateIn:Win32OperatingSystem
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
   175
!
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
   176
9100
0ebdc95e88ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9094
diff changeset
   177
Win32OperatingSystem::Win32IOHandle subclass:#Win32SocketHandle
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   178
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   179
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   180
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   181
	privateIn:Win32OperatingSystem
9092
286c8b9e8780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9089
diff changeset
   182
!
286c8b9e8780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9089
diff changeset
   183
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
   184
ByteArray variableByteSubclass:#WinPointStructure
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   185
	instanceVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   186
	classVariableNames:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   187
	poolDictionaries:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   188
	privateIn:Win32OperatingSystem
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
   189
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
   190
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   191
!Win32OperatingSystem primitiveDefinitions!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   192
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   193
14364
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
   194
# define WINVER 0x0500   /*required for CoInitializeEx*/
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
   195
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
   196
#include "stxOSDefs.h"
14852
f8cf16374fd5 Fix getnameinfo() and getaddrinfo() #ifdefed code
Stefan Vogel <sv@exept.de>
parents: 14849
diff changeset
   197
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
   198
#define USE_H_ERRNO
6095
fd28101edf09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5922
diff changeset
   199
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
   200
# if defined(i386) || defined(__i386__)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   201
#  ifndef _X86_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   202
#   define _X86_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   203
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   204
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   205
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   206
/*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   207
 * notice: although many systems' include files
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   208
 * already block against multiple inclusion, some
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   209
 * do not. Therefore, this is done here again.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   210
 * (it does not hurt)
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   211
 */
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   212
# ifndef _SIGNAL_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   213
#  include <signal.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   214
#  define _SIGNAL_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   215
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   216
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   217
# ifndef _SYS_TYPES_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   218
#  include <sys/types.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   219
#  define _SYS_TYPES_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   220
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   221
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   222
# ifndef _TIME_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   223
#  include <time.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   224
#  define _TIME_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   225
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   226
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   227
# ifndef _SYS_TIMEB_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   228
#  include <sys/timeb.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   229
#  define _SYS_TIMEB_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   230
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   231
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   232
# ifndef _SYS_STAT_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   233
#  include <sys/stat.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   234
#  define _SYS_STAT_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   235
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   236
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   237
# ifndef _ERRNO_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   238
#  include <errno.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   239
#  define _ERRNO_H_INCLUDED_
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
# ifndef _STDIO_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   243
#  include <stdio.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   244
#  define _STDIO_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   245
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   246
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   247
# ifndef _FCNTL_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   248
#  include <fcntl.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   249
#  define _FCNTL_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   250
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   251
8651
a346a806f4cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8650
diff changeset
   252
/* # define PROCESSDEBUGWIN32     /* */
a346a806f4cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8650
diff changeset
   253
/* # define PROCESS1DEBUGWIN32    /* */
a346a806f4cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8650
diff changeset
   254
/* # define PROCESS2DEBUGWIN32    /* */
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
   255
/* # define PROCESSDEBUG_CHILDPROCESSWAIT    /* */
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   256
/* # define SELECTDEBUGWIN32     /* */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   257
/* # define SELECT1DEBUGWIN32    /* */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   258
/* # define SELECT2DEBUGWIN32    /* */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   259
/* # define WAITDEBUGWIN32       /* */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   260
/* # define SIGNALDEBUGWIN32     /* */
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   261
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   262
# undef INT
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   263
# undef UINT
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   264
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   265
# undef Array
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   266
# undef Number
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   267
# undef Method
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   268
# undef Point
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   269
# undef Rectangle
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   270
# undef Block
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   271
# undef String
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   272
# undef Message
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   273
# undef Object
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
   274
# undef Class
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   275
# undef Context
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   276
# undef Time
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   277
# undef Date
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   278
# undef Set
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   279
# undef Signal
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   280
# undef Delay
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   281
# undef Message
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   282
# undef Process
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   283
# undef NameSpace
10341
5138e7faf10b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10334
diff changeset
   284
# undef Processor
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   285
# undef String
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   286
# undef Character
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   287
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   288
# include <stdarg.h> /* */
9092
286c8b9e8780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9089
diff changeset
   289
7531
4682ca752d27 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7287
diff changeset
   290
# ifndef WINDOWS_H_INCLUDED
4682ca752d27 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7287
diff changeset
   291
#  define WINDOWS_H_INCLUDED
4682ca752d27 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7287
diff changeset
   292
#  include <windows.h>
4682ca752d27 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7287
diff changeset
   293
# endif
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   294
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
   295
# ifndef TLHELP32_H_INCLUDE
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
   296
#  define TLHELP32_H_INCLUDE
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
   297
#  include <TLHELP32.h>         /* to get all processes in system */
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
   298
#endif
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
   299
6543
916373aeb49f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6542
diff changeset
   300
# ifndef NO_GETADAPTERSINFO
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   301
#  include <iphlpapi.h>
6543
916373aeb49f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6542
diff changeset
   302
# endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   303
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   304
# ifndef WINDOWSX_H_INCLUDED
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   305
#  define WINDOWSX_H_INCLUDED
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   306
#  include <windowsx.h>
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   307
# endif
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   308
11217
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   309
# define _WIN32_DCOM     /*required for CoInitializeEx*/
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   310
# include <objbase.h>    //for COM
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   311
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   312
# include <shlobj.h>
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   313
# include <objbase.h>
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   314
# include <initguid.h>
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   315
# ifndef _STRING_H_INCLUDED_
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   316
#  define _STRING_H_INCLUDED_
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   317
#  include <string.h>
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   318
# endif
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   319
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   320
# ifdef __DEF_Array
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   321
#  define Array __DEF_Array
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   322
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   323
# ifdef __DEF_Number
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   324
#  define Number __DEF_Number
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   325
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   326
# ifdef __DEF_Method
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   327
#  define Method __DEF_Method
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   328
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   329
# ifdef __DEF_Point
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   330
#  define Point __DEF_Point
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   331
# endif
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
   332
# ifdef __DEF_Rectangle
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
   333
#  define Rectangle __DEF_Rectangle
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
   334
# endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   335
# ifdef __DEF_Block
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   336
#  define Block __DEF_Block
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   337
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   338
# ifdef __DEF_String
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   339
#  define String __DEF_String
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   340
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   341
# ifdef __DEF_Message
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   342
#  define Message __DEF_Message
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   343
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   344
# ifdef __DEF_Object
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   345
#  define Object __DEF_Object
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   346
# endif
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
   347
# ifndef __DEF_Class
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
   348
#  define Class __DEF_Class
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
   349
# endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   350
# ifdef __DEF_Context
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   351
#  define Context __DEF_Context
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   352
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   353
# ifdef __DEF_Date
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   354
#  define Date __DEF_Date
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   355
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   356
# ifdef __DEF_Time
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   357
#  define Time __DEF_Time
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_Set
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   360
#  define Set __DEF_Set
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_Signal
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   363
#  define Signal __DEF_Signal
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_Delay
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   366
#  define Delay __DEF_Delay
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   367
# endif
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   368
# ifdef __DEF_Message
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   369
#  define Message __DEF_Message
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   370
# endif
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   371
# ifdef __DEF_Process
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   372
#  define Process __DEF_Process
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   373
# endif
10341
5138e7faf10b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10334
diff changeset
   374
# ifdef __DEF_Processor
5138e7faf10b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10334
diff changeset
   375
#  define Processor __DEF_Processor
5138e7faf10b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10334
diff changeset
   376
# endif
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   377
# ifdef __DEF_NameSpace
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   378
#  define NameSpace __DEF_NameSpace
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
   379
# endif
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   380
# ifdef __DEF_String
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   381
#  define String __DEF_String
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   382
# endif
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   383
# ifdef __DEF_Character
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   384
#  define Character __DEF_Character
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   385
# endif
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   386
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   387
# define INT STX_INT
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
   388
# define UINT STX_UINT
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   389
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   390
typedef int (*intf)(int);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   391
BOOL __signalUserInterruptWIN32(DWORD sig);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   392
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   393
# if defined (HAS_LOCALECONV)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   394
#  ifndef _LOCALE_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   395
#   include <locale.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   396
#   define _LOCALE_H_INCLUDED_
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
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   399
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   400
# ifdef __BORLANDC__
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   401
#  include <dir.h>
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
   402
#  define xMAXPATHLEN MAXPATH
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   403
#  define MAXFILELEN MAXFILE
9094
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   404
14740
609c0c77a4c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14731
diff changeset
   405
#  if 0
9094
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   406
OBJ _SEND0(OBJ, OBJ, OBJ, inlineCachePtr);
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   407
OBJ _SEND1(OBJ, OBJ, OBJ, inlineCachePtr, OBJ);
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   408
OBJ _SEND2(OBJ, OBJ, OBJ, inlineCachePtr, OBJ, OBJ);
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   409
OBJ _SEND3(OBJ, OBJ, OBJ, inlineCachePtr, OBJ, OBJ, OBJ);
14740
609c0c77a4c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14731
diff changeset
   410
#  endif
9094
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   411
10449
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
   412
# endif /* BORLANDC */
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
   413
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
   414
# ifndef __BORLANDC__
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
   415
#   define chmod _chmod
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
   416
# endif /* not BORLANDC */
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   417
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   418
# ifndef MAXPATHLEN
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
   419
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
   420
#  ifdef FILENAME_MAX
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
   421
#   define xMAXPATHLEN FILENAME_MAX
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   422
#  endif
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
   423
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   424
#  ifndef MAXPATHLEN
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
   425
#   define MAXPATHLEN 1024
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   426
#  endif
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
   427
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   428
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   429
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   430
/*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   431
 * sigaction dummies (you won't believe these call themself ``POSIX'' systems ...)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   432
 */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   433
# ifndef SA_RESTART
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   434
#  define SA_RESTART    0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   435
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   436
# ifndef SA_SIGINFO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   437
#  define SA_SIGINFO    0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   438
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   439
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   440
# if defined(HAS_WAITPID) || defined(HAS_WAIT3)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   441
#  include <sys/wait.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   442
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   443
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   444
# if defined(HAS_SYSINFO)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   445
#  include <sys/systeminfo.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   446
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   447
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
   448
# ifndef __BORLANDC__
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
   449
#  ifndef COINIT_MULTITHREADED
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
   450
#   define COINIT_MULTITHREADED 0x0
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
   451
#  endif
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
   452
# endif
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
   453
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   454
#define SIGHANDLER_ARG int
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   455
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   456
#define _HANDLEVal(o)        (HANDLE)(__externalAddressVal(o))
14636
26765f6a6b11 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
   457
#define _SETHANDLEVal(o, v)  (__externalAddressVal(o) = (v))
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   458
15871
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   459
#if defined(__BORLANDC__)
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   460
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   461
typedef enum _TOKEN_ELEVATION_TYPE {
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   462
    TokenElevationTypeDefault = 1,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   463
    TokenElevationTypeFull,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   464
    TokenElevationTypeLimited,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   465
} TOKEN_ELEVATION_TYPE, *PTOKEN_ELEVATION_TYPE;
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   466
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   467
typedef struct _TOKEN_ELEVATION {
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   468
    DWORD TokenIsElevated;
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   469
} TOKEN_ELEVATION, *PTOKEN_ELEVATION;
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   470
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   471
typedef enum _TOKEN_INFORMATION_CLASS_V2 {
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   472
    nTokenUser = 1,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   473
    nTokenGroups,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   474
    nTokenPrivileges,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   475
    nTokenOwner,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   476
    nTokenPrimaryGroup,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   477
    nTokenDefaultDacl,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   478
    nTokenSource,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   479
    nTokenType,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   480
    nTokenImpersonationLevel,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   481
    nTokenStatistics,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   482
    nTokenRestrictedSids,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   483
    nTokenSessionId,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   484
    nTokenGroupsAndPrivileges,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   485
    nTokenSessionReference,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   486
    nTokenSandBoxInert,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   487
    nTokenAuditPolicy,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   488
    nTokenOrigin,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   489
    nTokenElevationType,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   490
    nTokenLinkedToken,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   491
    nTokenElevation,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   492
    nTokenHasRestrictions,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   493
    nTokenAccessInformation,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   494
    nTokenVirtualizationAllowed,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   495
    nTokenVirtualizationEnabled,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   496
    nTokenIntegrityLevel,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   497
    nTokenUIAccess,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   498
    nTokenMandatoryPolicy,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   499
    nTokenLogonSid,
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   500
    nMaxTokenInfoClass  // MaxTokenInfoClass should always be the last enum
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   501
} TOKEN_INFORMATION_CLASS_V2, *PTOKEN_INFORMATION_CLASS_V2;
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   502
# define TokenElevationType (TOKEN_INFORMATION_CLASS)nTokenElevationType
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   503
# define TokenElevation     (TOKEN_INFORMATION_CLASS)nTokenElevation
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   504
#endif
2cb35be4d68f isRunningElevated
Claus Gittinger <cg@exept.de>
parents: 15870
diff changeset
   505
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   506
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   507
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   508
11258
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
   509
!Win32OperatingSystem primitiveVariables!
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
   510
%{
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
   511
static int coInitialized = 0;
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
   512
%}
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
   513
! !
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
   514
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   515
!Win32OperatingSystem primitiveFunctions!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   516
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   517
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   518
/* isWindows-NT flag:
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   519
 *  1 for NT based systemes, such as NT,XP or 2k
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   520
 *  0 for w95 based systems, such as w95/w98/ME
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   521
 */
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   522
static int __isWinNT = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   523
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   524
#define __wait wait
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   525
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   526
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   527
static int
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   528
_canAccessIOWithoutBlocking (aFD, readMode)
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   529
int aFD;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   530
int readMode;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   531
{
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   532
    struct timeval tv;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   533
    fd_set         fds;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   534
    int            n;
10454
0905cc7c6903 readCheck for broken non-socket (broken named pipes) fixed;
Claus Gittinger <cg@exept.de>
parents: 10449
diff changeset
   535
    int winErrNo;
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   536
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   537
/* we use the osfhandle insteat of the fd !! WHY ?? (I do not know)
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   538
   but otherwise it not works
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   539
*/
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   540
    int sock = (int) _get_osfhandle (aFD);
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   541
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   542
    FD_ZERO( & fds );
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   543
    FD_SET ( sock, & fds );
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   544
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   545
    tv.tv_sec  = 0;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   546
    tv.tv_usec = 0;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   547
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   548
    if (readMode) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   549
	n = select (sock + 1, & fds, NULL, NULL, & tv);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   550
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   551
	n = select (sock + 1, NULL, & fds, NULL, & tv);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   552
    }
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   553
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   554
    if (n == 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   555
	return (0);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   556
    }
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   557
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   558
    if (n > 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   559
	return ((FD_ISSET (sock, & fds)) ? 1 : 0);
10454
0905cc7c6903 readCheck for broken non-socket (broken named pipes) fixed;
Claus Gittinger <cg@exept.de>
parents: 10449
diff changeset
   560
    }
0905cc7c6903 readCheck for broken non-socket (broken named pipes) fixed;
Claus Gittinger <cg@exept.de>
parents: 10449
diff changeset
   561
0905cc7c6903 readCheck for broken non-socket (broken named pipes) fixed;
Claus Gittinger <cg@exept.de>
parents: 10449
diff changeset
   562
    winErrNo = WSAGetLastError();
0905cc7c6903 readCheck for broken non-socket (broken named pipes) fixed;
Claus Gittinger <cg@exept.de>
parents: 10449
diff changeset
   563
    switch (winErrNo) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   564
	case WSAENOTSOCK:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   565
	    if (readMode) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   566
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   567
		DWORD  w = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   568
		HANDLE h = (HANDLE) _get_osfhandle (aFD);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   569
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   570
		if (PeekNamedPipe (h, 0, 0, 0, & w, 0)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   571
		    if( !__isWinNT || w > 0 )
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   572
			return (1);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   573
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   574
		    return (0);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   575
		}
10458
678c2c39488f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10454
diff changeset
   576
#if 0
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   577
		console_fprintf(stderr, "_canAccessIOWithoutBlocking non Socket\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   578
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   579
		return (-1);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   580
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   581
	    /* in writeMode we return allways true for none-sockets */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   582
	    return (1);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   583
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   584
	case WSAEINPROGRESS:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   585
	case WSAEWOULDBLOCK:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   586
	    return (0);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   587
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   588
	default:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   589
	    console_fprintf(stderr, "_canAccessIOWithoutBlocking -> %d (0x%x)\n", winErrNo, winErrNo);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   590
	    return (-1);
10454
0905cc7c6903 readCheck for broken non-socket (broken named pipes) fixed;
Claus Gittinger <cg@exept.de>
parents: 10449
diff changeset
   591
    }
0905cc7c6903 readCheck for broken non-socket (broken named pipes) fixed;
Claus Gittinger <cg@exept.de>
parents: 10449
diff changeset
   592
0905cc7c6903 readCheck for broken non-socket (broken named pipes) fixed;
Claus Gittinger <cg@exept.de>
parents: 10449
diff changeset
   593
    /* not reached */
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   594
    return (0);
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   595
}
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   596
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   597
#define _canReadWithoutBlocking(fd)     _canAccessIOWithoutBlocking(fd, 1)
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   598
#define _canWriteWithoutBlocking(fd)    _canAccessIOWithoutBlocking(fd, 0)
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   599
11217
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   600
/*
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   601
 * 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
   602
 * 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
   603
 * load the library and looks what we get.
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   604
 * Here are support functions to load the libs.
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   605
 */
8654
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   606
static FARPROC
11217
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   607
__get_functionAddress(HINSTANCE *pLibHandle, char *libraryName, char *functionName)
8654
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   608
{
9094
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   609
    FARPROC entry;
11217
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   610
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   611
    if (*pLibHandle == NULL) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   612
	*pLibHandle = LoadLibrary(libraryName);
11217
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   613
    }
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   614
    entry = GetProcAddress(*pLibHandle, functionName);
8654
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   615
    return entry;
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   616
}
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   617
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   618
static FARPROC
11217
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   619
__get_kernel32_functionAddress(char *functionName)
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   620
{
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   621
    static HINSTANCE libHandle = NULL;
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   622
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   623
    return __get_functionAddress(&libHandle, "kernel32.DLL", functionName);
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   624
}
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   625
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   626
static FARPROC
8654
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   627
__get_iphlpapi_functionAddress(functionName)
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   628
    char *functionName;
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   629
{
11217
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   630
    static HINSTANCE libHandle = NULL;
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
    return __get_functionAddress(&libHandle, "iphlpapi.DLL", functionName);
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   633
}
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
static FARPROC
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   636
__get_ole32_functionAddress(functionName)
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   637
    char *functionName;
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   638
{
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   639
    static HINSTANCE libHandle = NULL;
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   640
c9b8dec0091b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11216
diff changeset
   641
    return __get_functionAddress(&libHandle, "ole32.DLL", functionName);
8654
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   642
}
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   643
13197
74f2ab2f4c51 comment
Claus Gittinger <cg@exept.de>
parents: 13159
diff changeset
   644
/*
74f2ab2f4c51 comment
Claus Gittinger <cg@exept.de>
parents: 13159
diff changeset
   645
 * The difference between the Windows epoch (1601-01-01 00:00:00)
74f2ab2f4c51 comment
Claus Gittinger <cg@exept.de>
parents: 13159
diff changeset
   646
 * and the Unix epoch (1970-01-01 00:00:00) in milliseconds is: 11644473600000L
74f2ab2f4c51 comment
Claus Gittinger <cg@exept.de>
parents: 13159
diff changeset
   647
 */
12821
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
   648
void
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
   649
TimetToFileTime( time_t t, LPFILETIME pft )
12817
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
   650
{
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
   651
    LONGLONG ll = Int32x32To64(t, 10000000) + 116444736000000000;
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
   652
    pft->dwLowDateTime = (DWORD) ll;
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
   653
    pft->dwHighDateTime = ll >>32;
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
   654
}
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
   655
12821
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
   656
OBJ
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
   657
FileTimeToOsTime(LPFILETIME pft)
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
   658
{
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
   659
    LONGLONG lTime = ((LONGLONG)pft->dwHighDateTime << 32) + pft->dwLowDateTime;
13197
74f2ab2f4c51 comment
Claus Gittinger <cg@exept.de>
parents: 13159
diff changeset
   660
    lTime = (lTime / 10000) - 11644473600000L;
12821
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
   661
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
   662
    return(__MKLARGEINT64(1, (unsigned INT)(lTime & 0xFFFFFFFF), (unsigned INT)(lTime >> 32)));
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
   663
}
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
   664
12817
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
   665
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   666
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   667
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   668
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   669
!Win32OperatingSystem class methodsFor:'documentation'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   670
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   671
copyright
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   672
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   673
 COPYRIGHT (c) 1988 by Claus Gittinger
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   674
 COPYRIGHT (c) 1998-2004 by eXept Software AG
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   675
	      All Rights Reserved
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   676
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   677
 This software is furnished under a license and may be used
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   678
 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
   679
 inclusion of the above copyright notice.   This software may not
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   680
 be provided or otherwise made available to, or used by, any
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   681
 other person.  No title to or ownership of the software is
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   682
 hereby transferred.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   683
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   684
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   685
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   686
documentation
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   687
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   688
    this class resulted from extracting WIN32 specifics of the old
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   689
    OperatingSystemClass into this sub-class.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   690
    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
   691
    or later.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   692
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   693
    this class realizes access to most (all ?) required operating system services;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   694
    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
   695
    things available here in your applications
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   696
    - 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
   697
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   698
    (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
   699
     from you - in some situations it MAY be interesting to be
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   700
     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
   701
     You decide - portability vs. functionality)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   702
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   703
    [Class variables:]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   704
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   705
	HostName        <String>        remembered hostname
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   706
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   707
	DomainName      <String>        remembered domainname
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   708
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   709
	CurrentDirectory <String>       remembered currentDirectories path
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   710
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   711
    [author:]
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   712
	Claus Gittinger (initial version & cleanup)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   713
	Manfred Dierolf (many features)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   714
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   715
    [see also:]
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   716
	OSProcessStatus
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   717
	Filename Date Time
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   718
	ExternalStream FileStream PipeStream Socket
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   719
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   720
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   721
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   722
examples
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   723
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   724
  various queries
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   725
								[exBegin]
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   726
    Transcript
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   727
	showCR:'hello ' , (OperatingSystem getLoginName)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   728
								[exEnd]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   729
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   730
								[exBegin]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   731
    OperatingSystem isUNIXlike ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   732
	Transcript showCR:'this is some UNIX-like OS'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   733
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   734
	Transcript showCR:'this OS is not UNIX-like'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   735
    ]
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   736
								[exEnd]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   737
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   738
								[exBegin]
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   739
    Transcript
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   740
	showCR:'this machine is called ' , OperatingSystem getHostName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   741
								[exEnd]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   743
								[exBegin]
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   744
    Transcript
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   745
	showCR:('this machine is in the '
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   746
	       , OperatingSystem getDomainName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   747
	       , ' domain')
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   748
								[exEnd]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   749
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   750
								[exBegin]
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   751
    Transcript
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   752
	showCR:('this machine''s CPU is a '
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   753
	       , OperatingSystem getCPUType
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   754
	       )
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   755
								[exEnd]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   756
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   757
								[exBegin]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   758
    Transcript showCR:'executing ls command ...'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   759
    OperatingSystem executeCommand:'ls'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   760
    Transcript showCR:'... done.'.
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   761
								[exEnd]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   762
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   763
  locking a file
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   764
  (should be executed on two running smalltalks - not in two threads):
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   765
								[exBegin]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   766
    |f|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   767
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   768
    f := 'testFile' asFilename readWriteStream.
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
    10 timesRepeat:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   771
	'about to lock ...' printCR.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   772
	[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   773
	  OperatingSystem
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   774
	    lockFD:(f fileDescriptor)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   775
	    shared:false
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   776
	    blocking:false
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   777
	] whileFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   778
	    'process ' print. OperatingSystem getProcessId print. ' is waiting' printCR.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   779
	    Delay waitForSeconds:1
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   780
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   781
	'LOCKED ...' printCR.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   782
	Delay waitForSeconds:10.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   783
	'unlock ...' printCR.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   784
	(OperatingSystem
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   785
	    unlockFD:(f fileDescriptor)) printCR.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   786
	Delay waitForSeconds:3.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   787
    ]
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   788
								[exBegin]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   789
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   790
! !
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
!Win32OperatingSystem class methodsFor:'initialization'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   793
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   794
coInitialize
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   795
%{
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   796
    HRESULT hres;
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   797
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   798
    if( ! coInitialized ) {
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
   799
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
   800
	hres = CoInitializeEx(NULL, COINIT_MULTITHREADED);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
   801
	if (! SUCCEEDED(hres)) {
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
   802
	    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
   803
	    goto error;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
   804
	}
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
   805
	coInitialized = 1;
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
   806
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   807
#ifdef COM_DEBUG
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
   808
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
   809
	console_fprintf(stderr, "OperatingSystem [info]: COM initialized\n" );
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
   810
#endif
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   811
    }
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   812
    RETURN (self );
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   813
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   814
error: ;
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   815
%}.
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   816
    self primitiveFailed
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   817
!
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   818
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   819
initOSType
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   820
    "internal - see if running under win-NT/XP/2k
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   821
     (as opposed to win-95/98/ME)"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   822
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   823
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   824
    OSVERSIONINFO osvi;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   825
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   826
    memset(&osvi, 0, sizeof(OSVERSIONINFO));
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   827
    osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   828
    GetVersionEx (&osvi);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   829
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   830
    if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   831
	__isWinNT = 1;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   832
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   833
	__isWinNT = 0;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   834
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   835
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   836
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   837
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   838
initialize
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   839
    "initialize the class"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   840
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   841
    "/ attention: must be ok to be called twice during startup.
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   842
    Initialized == nil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   843
	Initialized := true.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   844
	ObjectMemory addDependent:self.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   845
	HostName := nil.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   846
	DomainName := nil.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   847
	LastErrorNumber := nil.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   848
	PipeFailed := false.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   849
	self initOSType.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   850
	self coInitialize.
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
   851
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   852
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   853
    "Modified: 13.9.1997 / 10:47:32 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   854
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   855
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   856
update:something with:aParameter from:changedObject
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   857
    "catch image restart and flush some cached data"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   858
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   859
    something == #earlyRestart ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   860
	"
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   861
	 flush cached data
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   862
	"
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   863
	HostName := nil.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   864
	DomainName := nil.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   865
	LastErrorNumber := nil.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   866
	PipeFailed := false.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   867
	self initOSType.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
   868
	self coInitialize.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   869
    ]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   870
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   871
    "Modified: 22.4.1996 / 13:10:43 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   872
    "Created: 15.6.1996 / 15:22:37 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   873
    "Modified: 7.1.1997 / 19:36:11 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   874
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   875
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   876
!Win32OperatingSystem class methodsFor:'OS signal constants'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   877
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   878
sigABRT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   879
    "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
   880
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   881
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   882
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   883
#ifdef SIGABRT
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   884
    RETURN ( __mkSmallInteger(SIGABRT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   885
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   886
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   887
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   888
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   889
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   890
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   891
sigALRM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   892
    "return the signal number for SIGALRM - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   893
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   894
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   895
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   896
#ifdef SIGALRM
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   897
    RETURN ( __mkSmallInteger(SIGALRM) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   898
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   899
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   900
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   901
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   902
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   903
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   904
sigBREAK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   905
    "return the signal number for SIGBREAK - 0 if not supported.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   906
     This is an MSDOS specific signal"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   909
#ifdef SIGBREAK
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   910
    RETURN ( __mkSmallInteger(SIGBREAK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   911
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   912
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   913
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   914
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   915
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   916
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   917
sigBUS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   918
    "return the signal number for SIGBUS - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   919
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   920
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   921
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   922
#ifdef SIGBUS
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   923
    RETURN ( __mkSmallInteger(SIGBUS) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   924
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   925
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   926
#endif
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
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   929
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   930
sigCHLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   931
    "return the signal number for SIGCHLD - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   932
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   933
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   934
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   935
#if defined(SIGCHLD)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   936
    RETURN ( __mkSmallInteger(SIGCHLD) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   937
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   938
# if  defined(SIGCLD)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   939
    RETURN ( __mkSmallInteger(SIGCLD) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   940
# else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   941
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   942
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   943
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   944
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   945
!
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
sigCONT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   948
    "return the signal number for SIGCONT - 0 if not supported
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
#if defined(SIGCONT)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   953
    RETURN ( __mkSmallInteger(SIGCONT) );
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
sigDANGER
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   961
    "return the signal number for SIGDANGER - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   962
     (seems to be an AIX special)"
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
#if defined(SIGDANGER)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   966
    RETURN ( __mkSmallInteger(SIGDANGER) );
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
sigEMT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   974
    "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
   975
     (the numeric value is not the same across unix-systems)"
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 SIGEMT
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   979
    RETURN ( __mkSmallInteger(SIGEMT) );
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
sigFP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   987
    "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
   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 SIGFPE
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   992
    RETURN ( __mkSmallInteger(SIGFPE) );
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
sigGRANT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1000
    "return the signal number for SIGGRANT - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1001
     (seems to be an AIX special)"
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(SIGGRANT)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1005
    RETURN ( __mkSmallInteger(SIGGRANT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1006
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1007
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1008
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1009
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1010
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1011
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1012
sigHUP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1013
    "return the signal number for SIGHUP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1014
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1017
#ifdef SIGHUP
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1018
    RETURN ( __mkSmallInteger(SIGHUP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1019
#else
11669
db58374346b3 Define (and handle) the HUP and PWR signals
Stefan Vogel <sv@exept.de>
parents: 11623
diff changeset
  1020
    RETURN ( __mkSmallInteger(1) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1021
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1022
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1023
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1024
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1025
sigILL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1026
    "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
  1027
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1030
#ifdef SIGILL
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1031
    RETURN ( __mkSmallInteger(SIGILL) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1032
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1033
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1034
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1035
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1036
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1037
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1038
sigINT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1039
    "return the signal number for SIGINT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1040
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1043
#ifdef SIGINT
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1044
    RETURN ( __mkSmallInteger(SIGINT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1045
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1046
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1047
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1048
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1049
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1050
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1051
sigIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1052
    "return the signal number for SIGIO - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1053
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1056
#if defined(SIGIO)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1057
    RETURN ( __mkSmallInteger(SIGIO) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1058
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1059
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1060
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1061
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1062
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1063
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1064
sigIOT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1065
    "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
  1066
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1069
#ifdef SIGIOT
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1070
    RETURN ( __mkSmallInteger(SIGIOT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1071
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1072
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1073
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1074
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1075
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1076
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1077
sigKILL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1078
    "return the signal number for SIGKILL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1079
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1082
#ifdef SIGKILL
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1083
    RETURN ( __mkSmallInteger(SIGKILL) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1084
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1085
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1086
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1087
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1088
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1089
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1090
sigLOST
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1091
    "return the signal number for SIGLOST - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1092
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1095
#if defined(SIGLOST)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1096
    RETURN ( __mkSmallInteger(SIGLOST) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1097
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1098
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1099
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1100
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1101
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1102
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1103
sigMIGRATE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1104
    "return the signal number for SIGMIGRATE - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1105
     (seems to be an AIX special)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1108
#if defined(SIGMIGRATE)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1109
    RETURN ( __mkSmallInteger(SIGMIGRATE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1110
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1111
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1112
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1113
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1114
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1115
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1116
sigMSG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1117
    "return the signal number for SIGMSG - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1118
     (seems to be an AIX special)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1121
#if defined(SIGMSG)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1122
    RETURN ( __mkSmallInteger(SIGMSG) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1123
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1124
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1125
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1126
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1127
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1128
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1129
sigPIPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1130
    "return the signal number for SIGPIPE - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1131
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1134
#ifdef SIGPIPE
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1135
    RETURN ( __mkSmallInteger(SIGPIPE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1136
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1137
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1138
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1139
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1140
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1141
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1142
sigPOLL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1143
    "return the signal number for SIGPOLL - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1144
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1147
#if defined(SIGPOLL)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1148
    RETURN ( __mkSmallInteger(SIGPOLL) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1149
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1150
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1151
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1152
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1153
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1154
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1155
sigPRE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1156
    "return the signal number for SIGPRE - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1157
     (seems to be an AIX special)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1160
#if defined(SIGPRE)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1161
    RETURN ( __mkSmallInteger(SIGPRE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1162
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1163
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1164
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1165
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1166
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1167
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1168
sigPROF
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1169
    "return the signal number for SIGPROF - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1170
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1173
#if defined(SIGPROF)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1174
    RETURN ( __mkSmallInteger(SIGPROF) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1175
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1176
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1177
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1178
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1179
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1180
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1181
sigPWR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1182
    "return the signal number for SIGPWR - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1183
     (not available on all systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1186
#if defined(SIGPWR)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1187
    RETURN ( __mkSmallInteger(SIGPWR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1188
#else
11669
db58374346b3 Define (and handle) the HUP and PWR signals
Stefan Vogel <sv@exept.de>
parents: 11623
diff changeset
  1189
    RETURN ( __mkSmallInteger(30) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1190
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1191
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1192
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1193
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1194
sigQUIT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1195
    "return the signal number for SIGQUIT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1196
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1199
#ifdef SIGQUIT
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1200
    RETURN ( __mkSmallInteger(SIGQUIT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1201
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1202
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1203
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1204
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1205
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1206
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1207
sigRETRACT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1208
    "return the signal number for SIGRETRACT - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1209
     (seems to be an AIX special)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1212
#if defined(SIGRETRACT)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1213
    RETURN ( __mkSmallInteger(SIGRETRACT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1214
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1215
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1216
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1217
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1218
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1219
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1220
sigSAK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1221
    "return the signal number for SIGSAK - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1222
     (seems to be an AIX special)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1225
#if defined(SIGSAK)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1226
    RETURN ( __mkSmallInteger(SIGSAK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1227
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1228
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1229
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1230
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1231
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1232
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1233
sigSEGV
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1234
    "return the signal number for SIGSEGV - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1235
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1238
#ifdef SIGSEGV
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1239
    RETURN ( __mkSmallInteger(SIGSEGV) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1240
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1241
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1242
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1243
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1244
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1245
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1246
sigSOUND
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1247
    "return the signal number for SIGSOUND - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1248
     (seems to be an AIX special)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1251
#if defined(SIGSOUND)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1252
    RETURN ( __mkSmallInteger(SIGSOUND) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1253
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1254
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1255
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1256
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1257
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1258
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1259
sigSTOP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1260
    "return the signal number for SIGSTOP - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1261
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1264
#if defined(SIGSTOP)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1265
    RETURN ( __mkSmallInteger(SIGSTOP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1266
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1267
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1268
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1269
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1270
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1271
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1272
sigSYS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1273
    "return the signal number for SIGSYS - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1274
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1277
#ifdef SIGSYS
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1278
    RETURN ( __mkSmallInteger(SIGSYS) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1279
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1280
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1281
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1282
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1283
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1284
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1285
sigTERM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1286
    "return the signal number for SIGTERM - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1287
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1290
#ifdef SIGTERM
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1291
    RETURN ( __mkSmallInteger(SIGTERM) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1292
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1293
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1294
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1295
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1296
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1297
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1298
sigTRAP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1299
    "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
  1300
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1303
#ifdef SIGTRAP
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1304
    RETURN ( __mkSmallInteger(SIGTRAP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1305
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1306
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1307
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1308
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1309
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1310
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1311
sigTSTP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1312
    "return the signal number for SIGTSTP - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1313
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1316
#if defined(SIGTSTP)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1317
    RETURN ( __mkSmallInteger(SIGTSTP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1318
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1319
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1320
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1321
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1322
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1323
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1324
sigTTIN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1325
    "return the signal number for SIGTTIN - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1326
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1329
#if defined(SIGTTIN)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1330
    RETURN ( __mkSmallInteger(SIGTTIN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1331
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1332
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1333
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1334
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1335
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1336
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1337
sigTTOU
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1338
    "return the signal number for SIGTTOU - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1339
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1342
#if defined(SIGTTOU)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1343
    RETURN ( __mkSmallInteger(SIGTTOU) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1344
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1345
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1346
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1347
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1348
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1349
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1350
sigURG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1351
    "return the signal number for SIGURG - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1352
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1355
#if defined(SIGURG)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1356
    RETURN ( __mkSmallInteger(SIGURG) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1357
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1358
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1359
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1360
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1361
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1362
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1363
sigUSR1
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1364
    "return the signal number for SIGUSR1 - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1365
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1368
#if defined(SIGUSR1)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1369
    RETURN ( __mkSmallInteger(SIGUSR1) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1370
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1371
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1372
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1373
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1374
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1375
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1376
sigUSR2
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1377
    "return the signal number for SIGUSR2 - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1378
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1381
#if defined(SIGUSR2)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1382
    RETURN ( __mkSmallInteger(SIGUSR2) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1383
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1384
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1385
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1386
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1387
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1388
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1389
sigVTALRM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1390
    "return the signal number for SIGVTALRM - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1391
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1394
#if defined(SIGVTALRM)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1395
    RETURN ( __mkSmallInteger(SIGVTALRM) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1396
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1397
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1398
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1399
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1400
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1401
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1402
sigWINCH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1403
    "return the signal number for SIGWINCH - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1404
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1407
#if defined(SIGWINCH)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1408
    RETURN ( __mkSmallInteger(SIGWINCH) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1409
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1410
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1411
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1412
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1413
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1414
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1415
sigXCPU
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1416
    "return the signal number for SIGXCPU - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1417
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1420
#if defined(SIGXCPU)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1421
    RETURN ( __mkSmallInteger(SIGXCPU) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1422
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1423
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1424
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1425
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1426
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1427
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1428
sigXFSZ
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1429
    "return the signal number for SIGXFSZ - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1430
     (the numeric value is not the same across unix-systems)"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1433
#if defined(SIGXFSZ)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1434
    RETURN ( __mkSmallInteger(SIGXFSZ) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1435
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1436
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1437
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1438
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1439
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1440
9209
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1441
!Win32OperatingSystem class methodsFor:'VM messages'!
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1442
11511
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1443
win32LogFile
11513
97a94bac0991 comments
Claus Gittinger <cg@exept.de>
parents: 11512
diff changeset
  1444
    "return the name of the log file.
97a94bac0991 comments
Claus Gittinger <cg@exept.de>
parents: 11512
diff changeset
  1445
     This is mostly used by standAlone apps, without a console,
97a94bac0991 comments
Claus Gittinger <cg@exept.de>
parents: 11512
diff changeset
  1446
     which write their log info into a file named xxx_log_xxx.log.
97a94bac0991 comments
Claus Gittinger <cg@exept.de>
parents: 11512
diff changeset
  1447
     The default logFilename is defined be the make-build process, and
97a94bac0991 comments
Claus Gittinger <cg@exept.de>
parents: 11512
diff changeset
  1448
     can be overwritten by a command line argumen (--logFile). In order to
97a94bac0991 comments
Claus Gittinger <cg@exept.de>
parents: 11512
diff changeset
  1449
     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
  1450
     use this method to ask for the files name.
11513
97a94bac0991 comments
Claus Gittinger <cg@exept.de>
parents: 11512
diff changeset
  1451
     Returns nil, of nothing has been written to the logfile, yet.
97a94bac0991 comments
Claus Gittinger <cg@exept.de>
parents: 11512
diff changeset
  1452
     Enforce a logFile, by doing an errorPrint or infoPrint first."
11511
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1453
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1454
    |ret|
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1455
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1456
%{
11512
c6a1dc4bad14 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11511
diff changeset
  1457
    extern char *__win32_getLogFilename();
11511
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1458
    char *lp;
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1459
11512
c6a1dc4bad14 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11511
diff changeset
  1460
    lp = __win32_getLogFilename();
11511
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1461
    if (lp) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  1462
	ret = __MKSTRING(lp);
11511
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1463
    }
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1464
%}.
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1465
    ^ ret
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1466
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1467
    "
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1468
     Win32OperatingSystem win32LogFile
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1469
    "
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1470
!
8e097a558bac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11402
diff changeset
  1471
9209
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1472
win32LogFile:aFilenameOrNil
11513
97a94bac0991 comments
Claus Gittinger <cg@exept.de>
parents: 11512
diff changeset
  1473
    "change the file, into which log info is written.
97a94bac0991 comments
Claus Gittinger <cg@exept.de>
parents: 11512
diff changeset
  1474
     This is mostly used by standAlone apps, without a console,
97a94bac0991 comments
Claus Gittinger <cg@exept.de>
parents: 11512
diff changeset
  1475
     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
  1476
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1477
    |logFilePath|
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1478
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1479
    aFilenameOrNil notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  1480
	logFilePath := aFilenameOrNil asFilename pathName
9209
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1481
    ].
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1482
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1483
%{
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1484
    extern void __win32_setLogFile();
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1485
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  1486
    if (__isStringLike(logFilePath)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  1487
	__win32_setLogFile(__stringVal(logFilePath));
9209
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1488
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  1489
	__win32_setLogFile( NULL );
9209
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1490
    }
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1491
%}
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1492
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1493
    "
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1494
     Win32OperatingSystem win32LogFile:'myLog.log'
9210
ed7cf7380224 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9209
diff changeset
  1495
     Win32OperatingSystem win32LogFile:nil
9209
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1496
    "
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1497
! !
0b065c21f6c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9198
diff changeset
  1498
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
  1499
!Win32OperatingSystem class methodsFor:'accessing'!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
  1500
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
  1501
performanceData
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  1502
    ^ PerformanceData
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
  1503
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
  1504
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1505
!Win32OperatingSystem class methodsFor:'clipboard'!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1506
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1507
clipboardContainsBitmap
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  1508
	"Answer whether the clipboard contains a bitmap."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1509
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1510
    ^self clipboardContainsFormat: 2 "CfBitmap"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1511
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1512
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1513
clipboardContainsFormat: aCfConstant
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  1514
	"Answer true if the clipboard contains data in
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  1515
	 the format described by aCfConstant.  "
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1516
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1517
    ^self primIsClipboardFormatAvailable: aCfConstant
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1518
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1519
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1520
closeClipboard
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1521
    | result |
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1522
    result := self primCloseClipboard.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1523
    result ifFalse: [ ^self error].
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1524
    ^result
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1525
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1526
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1527
emptyClipboard
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  1528
	"Private - empty the clipboard. Note: it must be opened first."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1529
    | result |
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1530
    result := self primEmptyClipboard.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1531
    result ifFalse: [ ^self error].
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1532
    ^result
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1533
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1534
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1535
getDesktopWindow
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1536
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1537
    ^self primGetDesktopWindow
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1538
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1539
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1540
openClipboard
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1541
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1542
    ^self openClipboard: self getDesktopWindow
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1543
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1544
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1545
openClipboard: aHwnd
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1546
    | result |
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1547
    result := self primOpenClipboard: aHwnd.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1548
    result ifFalse: [ ^self error].
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1549
    ^result
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1550
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1551
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1552
primCloseClipboard
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1553
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1554
    <apicall: bool "CloseClipboard" () module: "user32.dll" >
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1555
    ^self primitiveFailed
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1556
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1557
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1558
primEmptyClipboard
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1559
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1560
    <apicall: bool "EmptyClipboard" () module: "user32.dll" >
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1561
    ^self primitiveFailed
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1562
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1563
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1564
primGetDesktopWindow
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1565
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1566
    <apicall: ulongReturn "GetDesktopWindow" () module: "user32.dll" >
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1567
    ^self primitiveFailed
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1568
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1569
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1570
primIsClipboardFormatAvailable: aCfConstant
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1571
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1572
    <apicall: boolean "IsClipboardFormatAvailable" (ulong) module: "user32.dll" >
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1573
     ^self primitiveFailed
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1574
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1575
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1576
primOpenClipboard: aHwnd
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1577
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1578
    <apicall: bool "OpenClipboard" (ulong) module: "user32.dll" >
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1579
    ^self primitiveFailed
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
primSetClipboardData: aCfConstant hMem: aMemHandle
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1583
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1584
    <apicall: ulongReturn "SetClipboardData" (ulong ulong) module: "user32.dll" >
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1585
    ^self primitiveFailed
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1586
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1587
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1588
setBitmapToClipboard: aBitmap
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  1589
	"Copy aBitmap to the clipboard."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1590
    | handle |
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1591
    aBitmap isNil ifTrue:[ ^nil ].
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1592
    aBitmap id isNil ifTrue:[aBitmap onDevice: Screen current].
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1593
    handle := aBitmap id.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1594
    handle isNil ifTrue: [ ^nil ].
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1595
    self openClipboard ifFalse: [ ^nil ].
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1596
    self emptyClipboard.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1597
    self setClipboardData: 2 "CfBitmap" hMem: handle.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1598
    self closeClipboard
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1599
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1600
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  1601
	self setBitmapToClipboard: Image fromUser
10968
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
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1605
setClipboardData: aCfConstant hMem: aMemHandle
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1606
    |result|
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1607
    result := self primSetClipboardData: aCfConstant hMem: aMemHandle address.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1608
    result = 0 ifTrue: [ ^self error ].
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  1609
! !
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  1610
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1611
!Win32OperatingSystem class methodsFor:'error messages'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1612
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1613
currentErrorNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1614
    "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
  1615
     Notice, that the value of this flag is only valid immediately
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1616
     after the error occurred - it gets updated with every other
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1617
     request to the OS.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1618
     Use lastErrorNumber - currentErrorNumber is invalidated by
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1619
     many, many internal calls."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1620
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1621
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1622
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1623
     RETURN ( __mkSmallInteger(__threadErrno) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1624
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1625
     "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1626
      OperatingSystem currentErrorNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1627
     "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1628
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1629
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1630
errorHolderForNumber:errNr
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  1631
    "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
  1632
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1633
    |sym typ holder|
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1634
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1635
%{
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1636
    /* claus:
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1637
     * I made this primitive code, since errnos are not
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1638
     * standard across operating systems
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1639
     */
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1640
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  1641
    if (__isSmallInteger(errNr) || (__unsignedLongIntVal(errNr) > 0)) {
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  1642
      int __eno = __unsignedLongIntVal(errNr);
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1643
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1644
      if (__isWIN32Error(__eno)) {
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1645
        switch (__eno & 0xFFFF) {
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1646
            /*
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1647
             * WIN32 GetLastError returns
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1648
             */
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1649
            case ERROR_INVALID_FUNCTION:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1650
                sym = @symbol(ERROR_INVALID_FUNCTION);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1651
                typ = @symbol(illegalOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1652
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1653
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1654
            case ERROR_BAD_FORMAT:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1655
                sym = @symbol(ERROR_BAD_FORMAT);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1656
                typ = @symbol(invalidArgumentsSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1657
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1658
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1659
            case ERROR_FILE_NOT_FOUND:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1660
                sym = @symbol(ERROR_FILE_NOT_FOUND);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1661
                typ = @symbol(nonexistentSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1662
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1663
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1664
            case ERROR_PATH_NOT_FOUND:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1665
                sym = @symbol(ERROR_PATH_NOT_FOUND);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1666
                typ = @symbol(nonexistentSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1667
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1668
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1669
            case ERROR_TOO_MANY_OPEN_FILES:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1670
                sym = @symbol(ERROR_TOO_MANY_OPEN_FILES);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1671
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1672
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1673
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1674
            /*
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1675
             * what a nice errorCode - thats the most "useful" one I ever
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1676
             * encountered ... (... those stupid micro-softies ...)
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1677
             */
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1678
            case ERROR_OPEN_FAILED:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1679
                sym = @symbol(ERROR_OPEN_FAILED);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1680
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1681
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1682
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1683
            case ERROR_ACCESS_DENIED:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1684
                sym = @symbol(ERROR_ACCESS_DENIED);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1685
                typ = @symbol(noPermissionsSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1686
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1687
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1688
            case ERROR_INVALID_HANDLE:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1689
                sym = @symbol(ERROR_INVALID_HANDLE);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1690
                typ = @symbol(invalidArgumentsSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1691
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1692
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1693
            case ERROR_NOT_ENOUGH_MEMORY:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1694
                sym = @symbol(ERROR_NOT_ENOUGH_MEMORY);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1695
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1696
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1697
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1698
            case ERROR_NO_SYSTEM_RESOURCES:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1699
                sym = @symbol(ERROR_NO_SYSTEM_RESOURCES);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1700
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1701
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1702
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1703
            case ERROR_NONPAGED_SYSTEM_RESOURCES:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1704
                sym = @symbol(ERROR_NONPAGED_SYSTEM_RESOURCES);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1705
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1706
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1707
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1708
            case ERROR_PAGED_SYSTEM_RESOURCES:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1709
                sym = @symbol(ERROR_PAGED_SYSTEM_RESOURCES);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1710
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1711
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1712
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1713
            case ERROR_INVALID_ACCESS:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1714
                sym = @symbol(ERROR_INVALID_ACCESS);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1715
                typ = @symbol(inappropriateOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1716
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1717
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1718
            case ERROR_INVALID_DATA:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1719
                sym = @symbol(ERROR_INVALID_DATA);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1720
                typ = @symbol(invalidArgumentsSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1721
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1722
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1723
            case ERROR_INVALID_NAME:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1724
                sym = @symbol(ERROR_INVALID_NAME);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1725
                typ = @symbol(invalidArgumentsSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1726
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1727
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1728
            case ERROR_ARENA_TRASHED:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1729
                sym = @symbol(ERROR_ARENA_TRASHED);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1730
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1731
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1732
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1733
            case ERROR_OUTOFMEMORY:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1734
                sym = @symbol(ERROR_OUTOFMEMORY);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1735
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1736
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1737
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1738
            case ERROR_BROKEN_PIPE:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1739
                sym = @symbol(ERROR_BROKEN_PIPE);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1740
                typ = @symbol(peerFaultSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1741
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1742
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1743
            case ERROR_GEN_FAILURE:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1744
                sym = @symbol(ERROR_GEN_FAILURE);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1745
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1746
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1747
            case ERROR_WRITE_PROTECT:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1748
                sym = @symbol(ERROR_WRITE_PROTECT);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1749
                typ = @symbol(inappropriateOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1750
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1751
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1752
            case ERROR_WRITE_FAULT:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1753
                sym = @symbol(ERROR_WRITE_FAULT);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1754
                typ = @symbol(transferFaultSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1755
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1756
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1757
            case ERROR_READ_FAULT:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1758
                sym = @symbol(ERROR_READ_FAULT);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1759
                typ = @symbol(transferFaultSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1760
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1761
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1762
            case ERROR_HANDLE_DISK_FULL:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1763
                sym = @symbol(ERROR_HANDLE_DISK_FULL);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1764
                typ = @symbol(volumeFullSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1765
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1766
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1767
            case ERROR_DISK_FULL:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1768
                sym = @symbol(ERROR_DISK_FULL);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1769
                typ = @symbol(volumeFullSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1770
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1771
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1772
            case ERROR_SHARING_VIOLATION:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1773
                sym = @symbol(ERROR_SHARING_VIOLATION);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1774
                typ = @symbol(noPermissionsSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1775
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1776
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1777
            case ERROR_LOCK_VIOLATION:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1778
                sym = @symbol(ERROR_LOCK_VIOLATION);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1779
                typ = @symbol(noPermissionsSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1780
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1781
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1782
            case ERROR_INVALID_PARAMETER:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1783
                sym = @symbol(ERROR_INVALID_PARAMETER);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1784
                typ = @symbol(invalidArgumentsSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1785
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1786
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1787
            case ERROR_NET_WRITE_FAULT:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1788
                sym = @symbol(ERROR_NET_WRITE_FAULT);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1789
                typ = @symbol(transferFaultSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1790
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1791
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1792
            case ERROR_NOT_SUPPORTED:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1793
                sym = @symbol(ERROR_NOT_SUPPORTED);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1794
                typ = @symbol(inappropriateOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1795
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1796
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1797
            case ERROR_REM_NOT_LIST:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1798
                sym = @symbol(ERROR_REM_NOT_LIST);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1799
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1800
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1801
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1802
            case ERROR_NETWORK_ACCESS_DENIED:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1803
                sym = @symbol(ERROR_NETWORK_ACCESS_DENIED);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1804
                typ = @symbol(noPermissionsSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1805
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1806
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1807
            case ERROR_DUP_NAME:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1808
                sym = @symbol(ERROR_DUP_NAME);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1809
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1810
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1811
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1812
            case ERROR_BAD_NETPATH:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1813
                sym = @symbol(ERROR_BAD_NETPATH);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1814
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1815
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1816
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1817
            case ERROR_NETWORK_BUSY:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1818
                sym = @symbol(ERROR_NETWORK_BUSY);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1819
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1820
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1821
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1822
            case ERROR_DRIVE_LOCKED:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1823
                sym = @symbol(ERROR_DRIVE_LOCKED);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1824
                typ = @symbol(inappropriateOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1825
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1826
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1827
            case ERROR_INVALID_DRIVE:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1828
                sym = @symbol(ERROR_INVALID_DRIVE);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1829
                typ = @symbol(invalidArgumentsSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1830
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1831
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1832
            case ERROR_WRONG_DISK:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1833
                sym = @symbol(ERROR_WRONG_DISK);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1834
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1835
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1836
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1837
            case ERROR_CURRENT_DIRECTORY:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1838
                sym = @symbol(ERROR_CURRENT_DIRECTORY);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1839
                typ = @symbol(invalidArgumentsSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1840
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1841
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1842
            /*
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1843
             * what a nice errorCode - thats the most "useful" one I ever
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1844
             * encountered ... (... those stupid micro-softies ...)
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1845
             */
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1846
            case ERROR_CANNOT_MAKE:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1847
                sym = @symbol(ERROR_CANNOT_MAKE);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1848
                typ = @symbol(inappropriateOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1849
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1850
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1851
            case ERROR_NO_MORE_FILES:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1852
                sym = @symbol(ERROR_NO_MORE_FILES);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1853
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1854
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1855
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1856
            case ERROR_NOT_READY:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1857
                sym = @symbol(ERROR_NOT_READY);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1858
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1859
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1860
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1861
            case ERROR_NOT_DOS_DISK:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1862
                sym = @symbol(ERROR_NOT_DOS_DISK);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1863
                typ = @symbol(invalidArgumentsSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1864
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1865
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1866
            case ERROR_OUT_OF_PAPER:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1867
                sym = @symbol(ERROR_OUT_OF_PAPER);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1868
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1869
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1870
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1871
            case ERROR_PRINTQ_FULL:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1872
                sym = @symbol(ERROR_PRINTQ_FULL);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1873
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1874
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1875
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1876
            case ERROR_FILE_EXISTS:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1877
                sym = @symbol(ERROR_FILE_EXISTS);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1878
                typ = @symbol(existingReferentSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1879
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1880
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1881
            default:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1882
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1883
        }
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1884
      } else {
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1885
        switch (__eno) {
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1886
            /*
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1887
             * POSIX errnos - these should be defined
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1888
             */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1889
#ifdef EPERM
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1890
            case EPERM:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1891
                sym = @symbol(EPERM);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1892
                typ = @symbol(noPermissionsSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1893
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1894
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1895
#ifdef ENOENT
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1896
            case ENOENT:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1897
                sym = @symbol(ENOENT);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1898
                typ = @symbol(nonexistentSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1899
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1900
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1901
#ifdef ESRCH
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1902
            case ESRCH:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1903
                sym = @symbol(ESRCH);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1904
                typ = @symbol(unavailableReferentSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1905
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1906
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1907
#ifdef EINTR
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1908
            case EINTR:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1909
                sym = @symbol(EINTR);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1910
                typ = @symbol(transientErrorSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1911
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1912
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1913
#ifdef EIO
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1914
            case EIO:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1915
                sym = @symbol(EIO);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1916
                typ = @symbol(transferFaultSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1917
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1918
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1919
#ifdef ENXIO
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1920
            case ENXIO:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1921
                sym = @symbol(ENXIO);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1922
                typ = @symbol(unavailableReferentSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1923
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1924
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1925
#ifdef E2BIG
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1926
            case E2BIG:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1927
                sym = @symbol(E2BIG);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1928
                typ = @symbol(invalidArgumentsSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1929
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1930
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1931
#ifdef ENOEXEC
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1932
            case ENOEXEC:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1933
                sym = @symbol(ENOEXEC);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1934
                typ = @symbol(inappropriateOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1935
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1936
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1937
#ifdef EBADF
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1938
            case EBADF:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1939
                sym = @symbol(EBADF);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1940
                typ = @symbol(badAccessorSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1941
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1942
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1943
#ifdef ECHILD
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1944
            case ECHILD:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1945
                sym = @symbol(ECHILD);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1946
                typ = @symbol(informationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1947
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1948
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1949
#if !defined(EWOULDBLOCK) && defined(EAGAIN) && (EWOULDBLOCK != EAGAIN)
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1950
            case EAGAIN:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1951
                sym = @symbol(EAGAIN);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1952
                typ = @symbol(notReadySignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1953
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1954
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1955
#ifdef ENOMEM
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1956
            case ENOMEM:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1957
                sym = @symbol(ENOMEM);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1958
                typ = @symbol(noMemorySignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1959
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1960
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1961
#ifdef EACCES
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1962
            case EACCES:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1963
                sym = @symbol(EACCES);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1964
                typ = @symbol(noPermissionsSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1965
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1966
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1967
#ifdef EFAULT
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1968
            case EFAULT:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1969
                sym = @symbol(EFAULT);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1970
                typ = @symbol(invalidArgumentsSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1971
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1972
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1973
#ifdef EBUSY
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1974
            case EBUSY:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1975
                sym = @symbol(EBUSY);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1976
                typ = @symbol(unavailableReferentSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1977
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1978
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1979
#ifdef EEXIST
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1980
            case EEXIST:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1981
                sym = @symbol(EEXIST);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1982
                typ = @symbol(existingReferentSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1983
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1984
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1985
#ifdef EXDEV
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1986
            case EXDEV:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1987
                sym = @symbol(EXDEV);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1988
                typ = @symbol(inappropriateReferentSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1989
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1990
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1991
#ifdef ENODEV
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1992
            case ENODEV:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1993
                sym = @symbol(ENODEV);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1994
                typ = @symbol(inaccessibleSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1995
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1996
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1997
#ifdef ENOTDIR
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1998
            case ENOTDIR:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  1999
                sym = @symbol(ENOTDIR);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2000
                typ = @symbol(inappropriateOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2001
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2002
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2003
#ifdef EISDIR
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2004
            case EISDIR:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2005
                sym = @symbol(EISDIR);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2006
                typ = @symbol(inappropriateOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2007
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2008
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2009
#ifdef EINVAL
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2010
            case EINVAL:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2011
                sym = @symbol(EINVAL);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2012
                typ = @symbol(invalidArgumentsSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2013
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2014
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2015
#ifdef ENFILE
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2016
            case ENFILE:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2017
                sym = @symbol(ENFILE);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2018
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2019
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2020
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2021
#ifdef EMFILE
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2022
            case EMFILE:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2023
                sym = @symbol(EMFILE);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2024
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2025
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2026
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2027
#ifdef ENOTTY
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2028
            case ENOTTY:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2029
                sym = @symbol(ENOTTY);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2030
                typ = @symbol(inappropriateOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2031
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2032
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2033
#ifdef EFBIG
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2034
            case EFBIG:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2035
                sym = @symbol(EFBIG);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2036
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2037
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2038
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2039
#ifdef ENOSPC
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2040
            case ENOSPC:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2041
                sym = @symbol(ENOSPC);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2042
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2043
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2044
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2045
#ifdef ESPIPE
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2046
            case ESPIPE:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2047
                sym = @symbol(ESPIPE);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2048
                typ = @symbol(inappropriateOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2049
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2050
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2051
#ifdef EROFS
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2052
            case EROFS:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2053
                sym = @symbol(EROFS);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2054
                typ = @symbol(inappropriateOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2055
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2056
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2057
#ifdef EMLINK
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2058
            case EMLINK:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2059
                sym = @symbol(EMLINK);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2060
                typ = @symbol(rangeErrorSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2061
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2062
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2063
#ifdef EPIPE
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2064
            case EPIPE:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2065
                sym = @symbol(EPIPE);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2066
                typ = @symbol(peerFaultSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2067
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2068
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2069
#ifdef EDOM
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2070
            case EDOM:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2071
                sym = @symbol(EDOM);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2072
                typ = @symbol(rangeErrorSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2073
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2074
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2075
#ifdef ERANGE
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2076
            case ERANGE:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2077
                sym = @symbol(ERANGE);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2078
                typ = @symbol(rangeErrorSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2079
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2080
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2081
#ifdef EDEADLK
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2082
# if EDEADLK != EWOULDBLOCK
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2083
            case EDEADLK:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2084
                sym = @symbol(EDEADLK);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2085
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
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
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2089
#ifdef ENAMETOOLONG
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2090
            case ENAMETOOLONG:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2091
                sym = @symbol(ENAMETOOLONG);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2092
                typ = @symbol(rangeErrorSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2093
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2094
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2095
#ifdef ENOLCK
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2096
            case ENOLCK:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2097
                sym = @symbol(ENOLCK);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2098
                typ = @symbol(inappropriateOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2099
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2100
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2101
#ifdef ENOSYS
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2102
            case ENOSYS:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2103
                sym = @symbol(ENOSYS);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2104
                typ = @symbol(inappropriateOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2105
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2106
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2107
#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST)
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2108
            case ENOTEMPTY:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2109
                sym = @symbol(ENOTEMPTY);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2110
                typ = @symbol(inappropriateReferentSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2111
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2112
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2113
#ifdef EILSEQ
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2114
            case EILSEQ:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2115
                sym = @symbol(EILSEQ);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2116
                typ = @symbol(transferFaultSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2117
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2118
#endif
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2119
            /*
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2120
             * XPG3 errnos - defined on most systems
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2121
             */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2122
#ifdef ENOTBLK
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2123
            case ENOTBLK:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2124
                sym = @symbol(ENOTBLK);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2125
                typ = @symbol(inappropriateReferentSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2126
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2127
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2128
#ifdef ETXTBSY
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2129
            case ETXTBSY:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2130
                sym = @symbol(ETXTBSY);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2131
                typ = @symbol(inaccessibleSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2132
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2133
#endif
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2134
            /*
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2135
             * some others
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2136
             */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2137
#ifdef EWOULDBLOCK
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2138
            case EWOULDBLOCK:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2139
                sym = @symbol(EWOULDBLOCK);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2140
                typ = @symbol(notReadySignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2141
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2142
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2143
#ifdef ENOMSG
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2144
            case ENOMSG:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2145
                sym = @symbol(ENOMSG);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2146
                typ = @symbol(noDataSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2147
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2148
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2149
#ifdef ELOOP
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2150
            case ELOOP:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2151
                sym = @symbol(ELOOP);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2152
                typ = @symbol(rangeErrorSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2153
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2154
#endif
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2155
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2156
            /*
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2157
             * some stream errors
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2158
             */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2159
#ifdef ETIME
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2160
            case ETIME:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2161
                sym = @symbol(ETIME);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2162
                typ = @symbol(peerFaultSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2163
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2164
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2165
#ifdef ENOSR
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2166
            case ENOSR:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2167
                sym = @symbol(ENOSR);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2168
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2169
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2170
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2171
#ifdef ENOSTR
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2172
            case ENOSTR:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2173
                sym = @symbol(ENOSTR);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2174
                typ = @symbol(inappropriateReferentSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2175
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2176
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2177
#ifdef ECOMM
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2178
            case ECOMM:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2179
                sym = @symbol(ECOMM);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2180
                typ = @symbol(transferFaultSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2181
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2182
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2183
#ifdef EPROTO
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2184
            case EPROTO:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2185
                sym = @symbol(EPROTO);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2186
                typ = @symbol(inappropriateOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2187
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2188
#endif
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2189
            /*
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2190
             * nfs errors
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2191
             */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2192
#ifdef ESTALE
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2193
            case ESTALE:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2194
                sym = @symbol(ESTALE);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2195
                typ = @symbol(unavailableReferentSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2196
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2197
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2198
#ifdef EREMOTE
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2199
            case EREMOTE:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2200
                sym = @symbol(EREMOTE);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2201
                typ = @symbol(rangeErrorSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2202
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2203
#endif
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2204
            /*
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2205
             * some networking errors
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2206
             */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2207
#ifdef EINPROGRESS
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2208
            case EINPROGRESS:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2209
                sym = @symbol(EINPROGRESS);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2210
                typ = @symbol(operationStartedSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2211
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2212
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2213
#ifdef EALREADY
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2214
            case EALREADY:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2215
                sym = @symbol(EALREADY);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2216
                typ = @symbol(operationStartedSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2217
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2218
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2219
#ifdef ENOTSOCK
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2220
            case ENOTSOCK:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2221
                sym = @symbol(ENOTSOCK);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2222
                typ = @symbol(inappropriateOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2223
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2224
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2225
#ifdef EDESTADDRREQ
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2226
            case EDESTADDRREQ:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2227
                sym = @symbol(EDESTADDRREQ);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2228
                typ = @symbol(underspecifiedSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2229
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2230
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2231
#ifdef EMSGSIZE
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2232
            case EMSGSIZE:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2233
                sym = @symbol(EMSGSIZE);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2234
                typ = @symbol(rangeErrorSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2235
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2236
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2237
#ifdef EPROTOTYPE
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2238
            case EPROTOTYPE:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2239
                sym = @symbol(EPROTOTYPE);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2240
                typ = @symbol(wrongSubtypeForOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2241
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2242
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2243
#ifdef ENOPROTOOPT
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2244
            case ENOPROTOOPT:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2245
                sym = @symbol(ENOPROTOOPT);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2246
                typ = @symbol(unsupportedOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2247
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2248
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2249
#ifdef EPROTONOSUPPORT
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2250
            case EPROTONOSUPPORT:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2251
                sym = @symbol(EPROTONOSUPPORT);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2252
                typ = @symbol(unsupportedOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2253
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2254
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2255
#ifdef ESOCKTNOSUPPORT
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2256
            case ESOCKTNOSUPPORT:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2257
                sym = @symbol(ESOCKTNOSUPPORT);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2258
                typ = @symbol(unsupportedOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2259
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2260
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2261
#ifdef EOPNOTSUPP
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2262
            case EOPNOTSUPP:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2263
                sym = @symbol(EOPNOTSUPP);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2264
                typ = @symbol(inappropriateOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2265
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2266
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2267
#ifdef EPFNOSUPPORT
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2268
            case EPFNOSUPPORT:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2269
                sym = @symbol(EPFNOSUPPORT);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2270
                typ = @symbol(unsupportedOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2271
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2272
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2273
#ifdef EAFNOSUPPORT
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2274
            case EAFNOSUPPORT:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2275
                sym = @symbol(EAFNOSUPPORT);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2276
                typ = @symbol(unsupportedOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2277
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2278
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2279
#ifdef EADDRINUSE
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2280
            case EADDRINUSE:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2281
                sym = @symbol(EADDRINUSE);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2282
                typ = @symbol(existingReferentSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2283
                break;
15816
ae834743050e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15779
diff changeset
  2284
#endif
ae834743050e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15779
diff changeset
  2285
#ifdef WSAEADDRINUSE
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2286
            case WSAEADDRINUSE:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2287
                sym = @symbol(WSAEADDRINUSE);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2288
                typ = @symbol(existingReferentSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2289
                break;
15816
ae834743050e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15779
diff changeset
  2290
#endif
ae834743050e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15779
diff changeset
  2291
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2292
#ifdef EADDRNOTAVAIL
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2293
            case EADDRNOTAVAIL:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2294
                sym = @symbol(EADDRNOTAVAIL);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2295
                typ = @symbol(noPermissionsSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2296
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2297
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2298
#ifdef ETIMEDOUT
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2299
            case ETIMEDOUT:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2300
                sym = @symbol(ETIMEDOUT);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2301
                typ = @symbol(peerFaultSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2302
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2303
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2304
#ifdef ECONNREFUSED
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2305
            case ECONNREFUSED:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2306
                sym = @symbol(ECONNREFUSED);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2307
                typ = @symbol(peerFaultSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2308
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2309
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2310
#ifdef ENETDOWN
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2311
            case ENETDOWN:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2312
                sym = @symbol(ENETDOWN);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2313
                typ = @symbol(peerFaultSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2314
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2315
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2316
#ifdef ENETUNREACH
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2317
            case ENETUNREACH:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2318
                sym = @symbol(ENETUNREACH);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2319
                typ = @symbol(peerFaultSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2320
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2321
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2322
#ifdef ENETRESET
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2323
            case ENETRESET:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2324
                sym = @symbol(ENETRESET);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2325
                typ = @symbol(peerFaultSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2326
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2327
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2328
#ifdef ECONNABORTED
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2329
            case ECONNABORTED:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2330
                sym = @symbol(ECONNABORTED);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2331
                typ = @symbol(peerFaultSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2332
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2333
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2334
#ifdef ECONNRESET
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2335
            case ECONNRESET:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2336
                sym = @symbol(ECONNRESET);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2337
                typ = @symbol(peerFaultSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
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 EISCONN
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2341
            case EISCONN:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2342
                sym = @symbol(EISCONN);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2343
                typ = @symbol(unpreparedOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
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 ENOTCONN
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2347
            case ENOTCONN:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2348
                sym = @symbol(ENOTCONN);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2349
                typ = @symbol(unpreparedOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
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 ESHUTDOWN
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2353
            case ESHUTDOWN:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2354
                sym = @symbol(ESHUTDOWN);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2355
                typ = @symbol(unpreparedOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
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 EHOSTDOWN
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2359
            case EHOSTDOWN:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2360
                sym = @symbol(EHOSTDOWN);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2361
                typ = @symbol(peerFaultSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2362
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2363
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2364
#ifdef EHOSTUNREACH
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2365
            case EHOSTUNREACH:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2366
                sym = @symbol(EHOSTUNREACH);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2367
                typ = @symbol(peerFaultSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2368
                break;
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2369
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2370
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2371
#ifdef WSAEFAULT
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2372
            case WSAEFAULT:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2373
                sym = @symbol(WSAEFAULT);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2374
                typ = @symbol(invalidArgumentsSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2375
                break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2376
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2377
#ifdef WSAEINTR
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2378
            case WSAEINTR:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2379
                sym = @symbol(WSAEINTR);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2380
                typ = @symbol(transientErrorSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2381
                break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2382
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2383
#ifdef WSAEBADF
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2384
            case WSAEBADF:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2385
                sym = @symbol(WSAEBADF);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2386
                typ = @symbol(badAccessorSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2387
                break;
15816
ae834743050e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15779
diff changeset
  2388
#endif
ae834743050e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15779
diff changeset
  2389
#ifdef WSAEACCES
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2390
            case WSAEACCES:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2391
                sym = @symbol(WSAEACCES);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2392
                typ = @symbol(badAccessorSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2393
                break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2394
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2395
#ifdef WSAEINVAL
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2396
            case WSAEINVAL:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2397
                sym = @symbol(WSAEINVAL);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2398
                typ = @symbol(invalidArgumentsSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2399
                break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2400
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2401
#ifdef WSAEMFILE
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2402
            case WSAEMFILE:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2403
                sym = @symbol(WSAEMFILE);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2404
                typ = @symbol(noResourcesSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2405
                break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2406
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2407
#ifdef WSAEWOULDBLOCK
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2408
            case WSAEWOULDBLOCK:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2409
                sym = @symbol(WSAEWOULDBLOCK);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2410
                typ = @symbol(notReadySignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2411
                break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2412
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2413
#ifdef WSAEINPROGRESS
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2414
            case WSAEINPROGRESS:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2415
                sym = @symbol(WSAEINPROGRESS);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2416
                typ = @symbol(operationStartedSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2417
                break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2418
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2419
#ifdef WSAEALREADY
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2420
            case WSAEALREADY:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2421
                sym = @symbol(WSAEALREADY);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2422
                typ = @symbol(operationStartedSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2423
                break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2424
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2425
#ifdef WSAENOTSOCK
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2426
            case WSAENOTSOCK:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2427
                sym = @symbol(WSAENOTSOCK);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2428
                typ = @symbol(inappropriateOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2429
                break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2430
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2431
#ifdef WSAEPROTONOSUPPORT
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2432
            case WSAEPROTONOSUPPORT:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2433
                sym = @symbol(WSAEPROTONOSUPPORT);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2434
                typ = @symbol(unsupportedOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2435
                break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2436
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2437
#ifdef WSAESOCKTNOSUPPORT
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2438
            case WSAESOCKTNOSUPPORT:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2439
                sym = @symbol(WSAESOCKTNOSUPPORT);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2440
                typ = @symbol(unsupportedOperationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2441
                break;
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2442
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2443
#ifdef E_NOINTERFACE
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2444
            case E_NOINTERFACE:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2445
                sym = @symbol(E_NOINTERFACE);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2446
                typ = @symbol(noInterfaceSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2447
                break;
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2448
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2449
#ifdef CO_E_NOTINITIALIZED
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2450
            case CO_E_NOTINITIALIZED:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2451
                sym = @symbol(CO_E_NOTINITIALIZED);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2452
                typ = @symbol(coNotInitializedSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2453
                break;
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2454
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2455
#ifdef REGDB_E_CLASSNOTREG
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2456
            case REGDB_E_CLASSNOTREG:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2457
                sym = @symbol(REGDB_E_CLASSNOTREG);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2458
                typ = @symbol(classNotRegisteredSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2459
                break;
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2460
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2461
#ifdef CLASS_E_NOAGGREGATION
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2462
            case CLASS_E_NOAGGREGATION:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2463
                sym = @symbol(CLASS_E_NOAGGREGATION);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2464
                typ = @symbol(noAggregationSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2465
                break;
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2466
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2467
#ifdef DISP_E_UNKNOWNNAME
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2468
            case DISP_E_UNKNOWNNAME:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2469
                sym = @symbol(DISP_E_UNKNOWNNAME);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2470
                typ = @symbol(unknownNameSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2471
                break;
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2472
#endif
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2473
#ifdef OLEOBJ_E_NOVERBS
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2474
            case OLEOBJ_E_NOVERBS:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2475
                sym = @symbol(OLEOBJ_E_NOVERBS);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2476
                typ = @symbol(noVerbsSignal);
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2477
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2478
#endif
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2479
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2480
            default:
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2481
                break;
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2482
        }
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2483
      }
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2484
    }
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2485
%}.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2486
    holder := OSErrorHolder new.
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2487
    sym isNil ifTrue:[
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2488
        sym := #ERROR_OTHER.
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2489
        errNr notNil ifTrue:[
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2490
            "keep symbols as symbols"
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2491
            holder parameter:(errNr isString ifTrue:[errNr] ifFalse:[errNr asString]).
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2492
        ].
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2493
    ].
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2494
    holder errorSymbol:sym errorCategory:(typ ? #defaultOsErrorSignal).
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2495
    ^ holder
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2496
16303
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2497
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2498
    "
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2499
     OperatingSystem errorHolderForNumber:4
aad4b514271c class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16289
diff changeset
  2500
     OperatingSystem errorHolderForNumber:#badArgument
15464
032fb42505bf class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15414
diff changeset
  2501
     self errorHolderForNumber:16777296
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  2502
     self errorHolderForNumber:(self errorNumberFor:#EPERM)
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2503
     self errorHolderForNumber:(self errorNumberFor:#EIO)
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2504
     self errorHolderForNumber:(self errorNumberFor:#ENXIO)
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2505
     self errorHolderForNumber:(self errorNumberFor:#E_NOINTERFACE)
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2506
    "
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2507
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2508
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2509
errorNumberFor:aSymbol
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2510
    "given a symbolic error, return the numeric;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2511
     (i.e. errorNumberFor:#EBADF returns EBADF's value).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2512
     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
  2513
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2514
%{   /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2515
    OBJ sym = aSymbol;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2516
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2517
    /*
15500
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  2518
     * WIN32 GetLastError error codes - use __WIN32_ERR() to return the same as
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  2519
     * the smalltalk methods
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2520
     */
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2521
#ifdef ERROR_INVALID_FUNCTION
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2522
    if (sym == @symbol(ERROR_INVALID_FUNCTION)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2523
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_INVALID_FUNCTION)) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2524
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2525
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2526
#ifdef ERROR_BAD_FORMAT
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2527
    if (sym == @symbol(ERROR_BAD_FORMAT)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2528
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_BAD_FORMAT)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2529
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2530
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2531
#ifdef ERROR_FILE_NOT_FOUND
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2532
    if (sym == @symbol(ERROR_FILE_NOT_FOUND)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2533
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_FILE_NOT_FOUND)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2534
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2535
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2536
#ifdef ERROR_PATH_NOT_FOUND
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2537
    if (sym == @symbol(ERROR_PATH_NOT_FOUND)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2538
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_PATH_NOT_FOUND)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2539
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2540
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2541
#ifdef ERROR_TOO_MANY_OPEN_FILES
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2542
    if (sym == @symbol(ERROR_TOO_MANY_OPEN_FILES)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2543
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_TOO_MANY_OPEN_FILES)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2544
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2545
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2546
#ifdef ERROR_OPEN_FAILED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2547
    if (sym == @symbol(ERROR_OPEN_FAILED)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2548
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_OPEN_FAILED)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2549
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2550
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2551
#ifdef ERROR_ACCESS_DENIED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2552
    if (sym == @symbol(ERROR_ACCESS_DENIED)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2553
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_ACCESS_DENIED)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2554
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2555
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2556
#ifdef ERROR_INVALID_HANDLE
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2557
    if (sym == @symbol(ERROR_INVALID_HANDLE)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2558
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_INVALID_HANDLE)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2559
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2560
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2561
#ifdef ERROR_NOT_ENOUGH_MEMORY
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2562
    if (sym == @symbol(ERROR_NOT_ENOUGH_MEMORY)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2563
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_NOT_ENOUGH_MEMORY)));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  2564
    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  2565
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  2566
#ifdef ERROR_NO_SYSTEM_RESOURCES
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  2567
    if (sym == @symbol(ERROR_NO_SYSTEM_RESOURCES)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2568
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_NO_SYSTEM_RESOURCES)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2569
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2570
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2571
#ifdef ERROR_INVALID_ACCESS
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2572
    if (sym == @symbol(ERROR_INVALID_ACCESS)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2573
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_INVALID_ACCESS)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2574
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2575
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2576
#ifdef ERROR_INVALID_DATA
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2577
    if (sym == @symbol(ERROR_INVALID_DATA)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2578
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_INVALID_DATA)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2579
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2580
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2581
#ifdef ERROR_INVALID_NAME
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2582
    if (sym == @symbol(ERROR_INVALID_NAME)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2583
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_INVALID_NAME)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2584
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2585
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2586
#ifdef ERROR_ARENA_TRASHED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2587
    if (sym == @symbol(ERROR_ARENA_TRASHED)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2588
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_ARENA_TRASHED)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2589
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2590
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2591
#ifdef ERROR_OUTOFMEMORY
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2592
    if (sym == @symbol(ERROR_OUTOFMEMORY)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2593
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_OUTOFMEMORY)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2594
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2595
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2596
#ifdef ERROR_BROKEN_PIPE
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2597
    if (sym == @symbol(ERROR_BROKEN_PIPE)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2598
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_BROKEN_PIPE)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2599
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2600
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2601
#ifdef ERROR_GEN_FAILURE
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2602
    if (sym == @symbol(ERROR_GEN_FAILURE)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2603
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_GEN_FAILURE)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2604
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2605
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2606
#ifdef ERROR_WRITE_PROTECT
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2607
    if (sym == @symbol(ERROR_WRITE_PROTECT)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2608
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_WRITE_PROTECT)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2609
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2610
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2611
#ifdef ERROR_WRITE_FAULT
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2612
    if (sym == @symbol(ERROR_WRITE_FAULT)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2613
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_WRITE_FAULT)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2614
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2615
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2616
#ifdef ERROR_READ_FAULT
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2617
    if (sym == @symbol(ERROR_READ_FAULT)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2618
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_READ_FAULT)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2619
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2620
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2621
#ifdef ERROR_HANDLE_DISK_FULL
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2622
    if (sym == @symbol(ERROR_HANDLE_DISK_FULL)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2623
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_HANDLE_DISK_FULL)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2624
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2625
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2626
#ifdef ERROR_DISK_FULL
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2627
    if (sym == @symbol(ERROR_DISK_FULL)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2628
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_DISK_FULL)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2629
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2630
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2631
#ifdef ERROR_ERROR_SHARING_VIOLATION
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2632
    if (sym == @symbol(ERROR_ERROR_SHARING_VIOLATION)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2633
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_ERROR_SHARING_VIOLATION)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2634
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2635
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2636
#ifdef ERROR_LOCK_VIOLATION
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2637
    if (sym == @symbol(ERROR_LOCK_VIOLATION)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2638
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_LOCK_VIOLATION)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2639
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2640
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2641
#ifdef ERROR_INVALID_PARAMETER
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2642
    if (sym == @symbol(ERROR_INVALID_PARAMETER)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2643
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_INVALID_PARAMETER)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2644
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2645
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2646
#ifdef ERROR_NET_WRITE_FAULT
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2647
    if (sym == @symbol(ERROR_NET_WRITE_FAULT)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2648
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_NET_WRITE_FAULT)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2649
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2650
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2651
#ifdef ERROR_NOT_SUPPORTED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2652
    if (sym == @symbol(ERROR_NOT_SUPPORTED)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2653
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_NOT_SUPPORTED)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2654
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2655
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2656
#ifdef ERROR_REM_NOT_LIST
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2657
    if (sym == @symbol(ERROR_REM_NOT_LIST)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2658
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_REM_NOT_LIST)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2659
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2660
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2661
#ifdef ERROR_NETWORK_ACCESS_DENIED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2662
    if (sym == @symbol(ERROR_NETWORK_ACCESS_DENIED)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2663
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_NETWORK_ACCESS_DENIED)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2664
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2665
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2666
#ifdef ERROR_DUP_NAME
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2667
    if (sym == @symbol(ERROR_DUP_NAME)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2668
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_DUP_NAME)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2669
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2670
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2671
#ifdef ERROR_BAD_NETPATH
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2672
    if (sym == @symbol(ERROR_BAD_NETPATH)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2673
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_BAD_NETPATH)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2674
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2675
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2676
#ifdef ERROR_NETWORK_BUSY
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2677
    if (sym == @symbol(ERROR_NETWORK_BUSY)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2678
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_NETWORK_BUSY)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2679
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2680
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2681
#ifdef ERROR_DRIVE_LOCKED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2682
    if (sym == @symbol(ERROR_DRIVE_LOCKED)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2683
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_DRIVE_LOCKED)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2684
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2685
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2686
#ifdef ERROR_INVALID_DRIVE
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2687
    if (sym == @symbol(ERROR_INVALID_DRIVE)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2688
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_INVALID_DRIVE)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2689
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2690
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2691
#ifdef ERROR_WRONG_DISK
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2692
    if (sym == @symbol(ERROR_WRONG_DISK)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2693
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_WRONG_DISK)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2694
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2695
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2696
#ifdef ERROR_CURRENT_DIRECTORY
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2697
    if (sym == @symbol(ERROR_CURRENT_DIRECTORY)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2698
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_CURRENT_DIRECTORY)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2699
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2700
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2701
#ifdef ERROR_CANNOT_MAKE
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2702
    if (sym == @symbol(ERROR_CANNOT_MAKE)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2703
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_CANNOT_MAKE)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2704
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2705
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2706
#ifdef ERROR_NO_MORE_FILES
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2707
    if (sym == @symbol(ERROR_NO_MORE_FILES)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2708
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_NO_MORE_FILES)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2709
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2710
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2711
#ifdef ERROR_NOT_READY
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2712
    if (sym == @symbol(ERROR_NOT_READY)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2713
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_NOT_READY)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2714
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2715
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2716
#ifdef ERROR_NOT_DOS_DISK
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2717
    if (sym == @symbol(ERROR_NOT_DOS_DISK)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2718
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_NOT_DOS_DISK)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2719
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2720
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2721
#ifdef ERROR_OUT_OF_PAPER
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2722
    if (sym == @symbol(ERROR_OUT_OF_PAPER)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2723
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_OUT_OF_PAPER)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2724
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2725
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2726
#ifdef ERROR_PRINTQ_FULL
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2727
    if (sym == @symbol(ERROR_PRINTQ_FULL)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2728
	RETURN ( __mkSmallInteger(__WIN32_ERR(ERROR_PRINTQ_FULL)));
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2729
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2730
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2731
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2732
    /*
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2733
     * POSIX errnos - these should be defined
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2734
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2735
#ifdef EPERM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2736
    if (sym == @symbol(EPERM)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2737
	RETURN ( __mkSmallInteger(EPERM) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2738
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2739
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2740
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2741
#ifdef ENOENT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2742
    if (sym == @symbol(ENOENT)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2743
	RETURN ( __mkSmallInteger(ENOENT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2744
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2745
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2746
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2747
#ifdef ESRCH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2748
    if (sym == @symbol(ESRCH)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2749
	RETURN ( __mkSmallInteger(ESRCH) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2750
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2751
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2752
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2753
#ifdef EINTR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2754
    if (sym == @symbol(EINTR)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2755
	RETURN ( __mkSmallInteger(EINTR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2756
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2757
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2758
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2759
#ifdef EIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2760
    if (sym == @symbol(EIO)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2761
	RETURN ( __mkSmallInteger(EIO) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2762
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2763
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2764
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2765
#ifdef ENXIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2766
    if (sym == @symbol(ENXIO)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2767
	RETURN ( __mkSmallInteger(ENXIO) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2768
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2769
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2770
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2771
#ifdef E2BIG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2772
    if (sym == @symbol(E2BIG)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2773
	RETURN ( __mkSmallInteger(E2BIG) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2774
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2775
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2776
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2777
#ifdef ENOEXEC
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2778
    if (sym == @symbol(ENOEXEC)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2779
	RETURN ( __mkSmallInteger(ENOEXEC) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2780
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2781
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2782
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2783
#ifdef EBADF
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2784
    if (sym == @symbol(EBADF)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2785
	RETURN ( __mkSmallInteger(EBADF) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2786
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2787
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2788
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2789
#ifdef ECHILD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2790
    if (sym == @symbol(ECHILD)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2791
	RETURN ( __mkSmallInteger(ECHILD) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2792
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2793
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2794
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2795
#if defined(EAGAIN)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2796
    if (sym == @symbol(EAGAIN)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2797
	RETURN ( __mkSmallInteger(EAGAIN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2798
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2799
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2800
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2801
#ifdef ENOMEM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2802
    if (sym == @symbol(ENOMEM)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2803
	RETURN ( __mkSmallInteger(ENOMEM) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2804
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2805
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2806
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2807
#ifdef EACCES
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2808
    if (sym == @symbol(EACCES)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2809
	RETURN ( __mkSmallInteger(EACCES) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2810
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2811
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2812
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2813
#ifdef EFAULT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2814
    if (sym == @symbol(EFAULT)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2815
	RETURN ( __mkSmallInteger(EFAULT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2816
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2817
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2818
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2819
#ifdef EBUSY
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2820
    if (sym == @symbol(EBUSY)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2821
	RETURN ( __mkSmallInteger(EBUSY) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2822
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2823
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2824
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2825
#ifdef EXDEV
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2826
    if (sym == @symbol(EXDEV)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2827
	RETURN ( __mkSmallInteger(EXDEV) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2828
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2829
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2830
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2831
#ifdef ENODEV
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2832
    if (sym == @symbol(ENODEV)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2833
	RETURN ( __mkSmallInteger(ENODEV) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2834
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2835
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2836
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2837
#ifdef ENOTDIR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2838
    if (sym == @symbol(ENOTDIR)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2839
	RETURN ( __mkSmallInteger(ENOTDIR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2840
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2841
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2842
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2843
#ifdef EISDIR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2844
    if (sym == @symbol(EISDIR)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2845
	RETURN ( __mkSmallInteger(EISDIR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2846
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2847
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2848
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2849
#ifdef EINVAL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2850
    if (sym == @symbol(EINVAL)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2851
	RETURN ( __mkSmallInteger(EINVAL) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2852
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2853
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2854
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2855
#ifdef ENFILE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2856
    if (sym == @symbol(ENFILE)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2857
	RETURN ( __mkSmallInteger(ENFILE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2858
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2859
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2860
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2861
#ifdef EMFILE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2862
    if (sym == @symbol(EMFILE)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2863
	RETURN ( __mkSmallInteger(EMFILE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2864
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2865
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2866
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2867
#ifdef ENOTTY
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2868
    if (sym == @symbol(ENOTTY)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2869
	RETURN ( __mkSmallInteger(ENOTTY) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2870
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2871
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2872
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2873
#ifdef EFBIG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2874
    if (sym == @symbol(EFBIG)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2875
	RETURN ( __mkSmallInteger(EFBIG) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2876
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2877
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2878
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2879
#ifdef ENOSPC
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2880
    if (sym == @symbol(ENOSPC)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2881
	RETURN ( __mkSmallInteger(ENOSPC) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2882
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2883
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2884
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2885
#ifdef ESPIPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2886
    if (sym == @symbol(ESPIPE)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2887
	RETURN ( __mkSmallInteger(ESPIPE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2888
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2889
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2890
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2891
#ifdef EROFS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2892
    if (sym == @symbol(EROFS)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2893
	RETURN ( __mkSmallInteger(EROFS) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2894
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2895
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2896
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2897
#ifdef EMLINK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2898
    if (sym == @symbol(EMLINK)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2899
	RETURN ( __mkSmallInteger(EMLINK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2900
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2901
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2902
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2903
#ifdef EPIPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2904
    if (sym == @symbol(EPIPE)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2905
	RETURN ( __mkSmallInteger(EPIPE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2906
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2907
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2908
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2909
#ifdef EDOM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2910
    if (sym == @symbol(EDOM)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2911
	RETURN ( __mkSmallInteger(EDOM) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2912
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2913
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2914
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2915
#ifdef ERANGE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2916
    if (sym == @symbol(ERANGE)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2917
	RETURN ( __mkSmallInteger(ERANGE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2918
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2919
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2920
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2921
#ifdef EDEADLK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2922
    if (sym == @symbol(EDEADLK)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2923
	RETURN ( __mkSmallInteger(EDEADLK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2924
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2925
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2926
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2927
#ifdef ENAMETOOLONG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2928
    if (sym == @symbol(ENAMETOOLONG)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2929
	RETURN ( __mkSmallInteger(ENAMETOOLONG) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2930
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2931
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2932
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2933
#ifdef ENOLCK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2934
    if (sym == @symbol(ENOLCK)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2935
	RETURN ( __mkSmallInteger(ENOLCK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2936
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2937
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2938
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2939
#ifdef ENOSYS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2940
    if (sym == @symbol(ENOSYS)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2941
	RETURN ( __mkSmallInteger(ENOSYS) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2942
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2943
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2944
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2945
#ifdef ENOTEMPTY
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2946
    if (sym == @symbol(ENOTEMPTY)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2947
	RETURN ( __mkSmallInteger(ENOTEMPTY) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2948
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2949
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2950
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2951
#ifdef EEXIST
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2952
    if (sym == @symbol(EEXIST)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2953
	RETURN ( __mkSmallInteger(EEXIST) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2954
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2955
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2956
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2957
#ifdef EILSEQ
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2958
    if (sym == @symbol(EILSEQ)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2959
	RETURN ( __mkSmallInteger(EILSEQ) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2960
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2961
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2962
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
     * XPG3 errnos - defined on most systems
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2965
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2966
#ifdef ENOTBLK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2967
    if (sym == @symbol(ENOTBLK)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2968
	RETURN ( __mkSmallInteger(ENOTBLK) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2971
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2972
#ifdef ETXTBSY
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2973
    if (sym == @symbol(ETXTBSY)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2974
	RETURN ( __mkSmallInteger(ETXTBSY) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2977
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2978
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2979
     * some others
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2980
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2981
#ifdef EWOULDBLOCK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2982
    if (sym == @symbol(EWOULDBLOCK)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2983
	RETURN ( __mkSmallInteger(EWOULDBLOCK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2984
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2985
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2986
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2987
#ifdef ENOMSG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2988
    if (sym == @symbol(ENOMSG)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2989
	RETURN ( __mkSmallInteger(ENOMSG) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2990
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2991
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2992
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2993
#ifdef ELOOP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2994
    if (sym == @symbol(ELOOP)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  2995
	RETURN ( __mkSmallInteger(ELOOP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2996
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2997
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2998
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
     * some stream errors
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3001
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3002
#ifdef ETIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3003
    if (sym == @symbol(ETIME)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3004
	RETURN ( __mkSmallInteger(ETIME) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3007
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3008
#ifdef ENOSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3009
    if (sym == @symbol(ENOSR)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3010
	RETURN ( __mkSmallInteger(ENOSR) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3013
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3014
#ifdef ENOSTR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3015
    if (sym == @symbol(ENOSTR)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3016
	RETURN ( __mkSmallInteger(ENOSTR) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3019
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3020
#ifdef ECOMM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3021
    if (sym == @symbol(ECOMM)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3022
	RETURN ( __mkSmallInteger(ECOMM) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3025
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3026
#ifdef EPROTO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3027
    if (sym == @symbol(EPROTO)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3028
	RETURN ( __mkSmallInteger(EPROTO) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3031
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3032
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3033
     * nfs errors
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3034
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3035
#ifdef ESTALE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3036
    if (sym == @symbol(ESTALE)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3037
	RETURN ( __mkSmallInteger(ESTALE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3038
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3039
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3040
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3041
#ifdef EREMOTE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3042
    if (sym == @symbol(EREMOTE)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3043
	RETURN ( __mkSmallInteger(EREMOTE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3044
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3045
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3046
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
     * some networking errors
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3049
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3050
#ifdef EINPROGRESS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3051
    if (sym == @symbol(EINPROGRESS)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3052
	RETURN ( __mkSmallInteger(EINPROGRESS) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3055
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3056
#ifdef EALREADY
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3057
    if (sym == @symbol(EALREADY)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3058
	RETURN ( __mkSmallInteger(EALREADY) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3061
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3062
#ifdef ENOTSOCK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3063
    if (sym == @symbol(ENOTSOCK)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3064
	RETURN ( __mkSmallInteger(ENOTSOCK) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3067
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3068
#ifdef EDESTADDRREQ
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3069
    if (sym == @symbol(EDESTADDRREQ)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3070
	RETURN ( __mkSmallInteger(EDESTADDRREQ) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3073
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3074
#ifdef EMSGSIZE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3075
    if (sym == @symbol(EMSGSIZE)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3076
	RETURN ( __mkSmallInteger(EMSGSIZE) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3079
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3080
#ifdef EPROTOTYPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3081
    if (sym == @symbol(EPROTOTYPE)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3082
	RETURN ( __mkSmallInteger(EPROTOTYPE) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3085
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3086
#ifdef ENOPROTOOPT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3087
    if (sym == @symbol(ENOPROTOOPT)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3088
	RETURN ( __mkSmallInteger(ENOPROTOOPT) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3091
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3092
#ifdef EPROTONOSUPPORT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3093
    if (sym == @symbol(EPROTONOSUPPORT)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3094
	RETURN ( __mkSmallInteger(EPROTONOSUPPORT) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3097
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3098
#ifdef ESOCKTNOSUPPORT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3099
    if (sym == @symbol(ESOCKTNOSUPPORT)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3100
	RETURN ( __mkSmallInteger(ESOCKTNOSUPPORT) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3103
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3104
#ifdef EOPNOTSUPP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3105
    if (sym == @symbol(EOPNOTSUPP)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3106
	RETURN ( __mkSmallInteger(EOPNOTSUPP) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3109
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3110
#ifdef EPFNOSUPPORT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3111
    if (sym == @symbol(EPFNOSUPPORT)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3112
	RETURN ( __mkSmallInteger(EPFNOSUPPORT) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3115
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3116
#ifdef EAFNOSUPPORT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3117
    if (sym == @symbol(EAFNOSUPPORT)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3118
	RETURN ( __mkSmallInteger(EAFNOSUPPORT) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3121
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3122
#ifdef EADDRINUSE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3123
    if (sym == @symbol(EADDRINUSE)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3124
	RETURN ( __mkSmallInteger(EADDRINUSE) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3127
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3128
#ifdef EADDRNOTAVAIL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3129
    if (sym == @symbol(EADDRNOTAVAIL)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3130
	RETURN ( __mkSmallInteger(EADDRNOTAVAIL) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3134
#ifdef ETIMEDOUT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3135
    if (sym == @symbol(ETIMEDOUT)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3136
	RETURN ( __mkSmallInteger(ETIMEDOUT) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3139
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3140
#ifdef ECONNREFUSED
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3141
    if (sym == @symbol(ECONNREFUSED)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3142
	RETURN ( __mkSmallInteger(ECONNREFUSED) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3145
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3146
#ifdef ENETDOWN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3147
    if (sym == @symbol(ENETDOWN)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3148
	RETURN ( __mkSmallInteger(ENETDOWN) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3151
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3152
#ifdef ENETUNREACH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3153
    if (sym == @symbol(ENETUNREACH)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3154
	RETURN ( __mkSmallInteger(ENETUNREACH) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3157
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3158
#ifdef ENETRESET
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3159
    if (sym == @symbol(ENETRESET)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3160
	RETURN ( __mkSmallInteger(ENETRESET) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3161
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3162
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3163
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3164
#ifdef ECONNABORTED
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3165
    if (sym == @symbol(ECONNABORTED)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3166
	RETURN ( __mkSmallInteger(ECONNABORTED) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3167
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3168
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3169
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3170
#ifdef ECONNRESET
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3171
    if (sym == @symbol(ECONNRESET)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3172
	RETURN ( __mkSmallInteger(ECONNRESET) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3175
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3176
#ifdef EISCONN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3177
    if (sym == @symbol(EISCONN)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3178
	RETURN ( __mkSmallInteger(EISCONN) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3181
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3182
#ifdef ENOTCONN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3183
    if (sym == @symbol(ENOTCONN)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3184
	RETURN ( __mkSmallInteger(ENOTCONN) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3187
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3188
#ifdef ESHUTDOWN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3189
    if (sym == @symbol(ESHUTDOWN)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3190
	RETURN ( __mkSmallInteger(ESHUTDOWN) );
5133
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
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3193
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3194
#ifdef EHOSTDOWN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3195
    if (sym == @symbol(EHOSTDOWN)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3196
	RETURN ( __mkSmallInteger(EHOSTDOWN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3197
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3198
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3199
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3200
#ifdef EHOSTUNREACH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3201
    if (sym == @symbol(EHOSTUNREACH)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3202
	RETURN ( __mkSmallInteger(EHOSTUNREACH) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3203
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3204
#endif
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3205
    /*
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3206
     * windows socket errors
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3207
     */
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3208
#ifdef WSAEINTR
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3209
    if (sym == @symbol(WSAEINTR)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3210
	RETURN ( __mkSmallInteger(WSAEINTR) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3211
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3212
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3213
#ifdef WSAEBADF
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3214
    if (sym == @symbol(WSAEBADF)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3215
	RETURN ( __mkSmallInteger(WSAEBADF) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3216
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3217
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3218
#ifdef WSAEACCESS
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3219
    if (sym == @symbol(WSAEACCESS)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3220
	RETURN ( __mkSmallInteger(WSAEACCESS) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3221
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3222
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3223
#ifdef WSAEFAULT
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3224
    if (sym == @symbol(WSAEFAULT)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3225
	RETURN ( __mkSmallInteger(WSAEFAULT) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3226
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3227
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3228
#ifdef WSAEINVAL
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3229
    if (sym == @symbol(WSAEINVAL)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3230
	RETURN ( __mkSmallInteger(WSAEINVAL) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3231
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3232
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3233
#ifdef WSAEMFILE
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3234
    if (sym == @symbol(WSAEMFILE)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3235
	RETURN ( __mkSmallInteger(WSAEMFILE) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3236
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3237
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3238
#ifdef WSAEWOULDBLOCK
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3239
    if (sym == @symbol(WSAEWOULDBLOCK)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3240
	RETURN ( __mkSmallInteger(WSAEWOULDBLOCK) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3241
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3242
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3243
#ifdef WSAEINPROGRESS
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3244
    if (sym == @symbol(WSAEINPROGRESS)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3245
	RETURN ( __mkSmallInteger(WSAEINPROGRESS) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3246
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3247
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3248
#ifdef WSAEALREADY
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3249
    if (sym == @symbol(WSAEALREADY)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3250
	RETURN ( __mkSmallInteger(WSAEALREADY) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3251
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3252
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3253
#ifdef WSAENOTSOCK
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3254
    if (sym == @symbol(WSAENOTSOCK)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3255
	RETURN ( __mkSmallInteger(WSAENOTSOCK) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3256
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3257
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3258
#ifdef WSAEPROTONOSUPPORT
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3259
    if (sym == @symbol(WSAEPROTONOSUPPORT)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3260
	RETURN ( __mkSmallInteger(WSAEPROTONOSUPPORT) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3261
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3262
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3263
#ifdef WSAESOCKTNOSUPPORT
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3264
    if (sym == @symbol(WSAESOCKTNOSUPPORT)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3265
	RETURN ( __mkSmallInteger(WSAESOCKTNOSUPPORT) );
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3266
    }
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3267
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3268
#ifdef E_NOINTERFACE
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3269
    if (sym == @symbol(E_NOINTERFACE)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3270
	RETURN ( __MKUINT(E_NOINTERFACE) );
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3271
    }
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3272
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3273
#ifdef CO_E_NOTINITIALIZED
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3274
    if (sym == @symbol(CO_E_NOTINITIALIZED)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3275
	RETURN ( __MKUINT(CO_E_NOTINITIALIZED) );
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3276
    }
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3277
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3278
#ifdef REGDB_E_CLASSNOTREG
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3279
    if (sym == @symbol(REGDB_E_CLASSNOTREG)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3280
	RETURN ( __MKUINT(REGDB_E_CLASSNOTREG) );
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3281
    }
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3282
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3283
#ifdef CLASS_E_NOAGGREGATION
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3284
    if (sym == @symbol(CLASS_E_NOAGGREGATION)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3285
	RETURN ( __MKUINT(CLASS_E_NOAGGREGATION) );
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3286
    }
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3287
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3288
#ifdef DISP_E_UNKNOWNNAME
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  3289
    if (sym == @symbol(DISP_E_UNKNOWNNAME)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3290
	RETURN ( __MKUINT(DISP_E_UNKNOWNNAME) );
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  3291
    }
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  3292
#endif
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  3293
#ifdef OLEOBJ_E_NOVERBS
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  3294
    if (sym == @symbol(OLEOBJ_E_NOVERBS)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3295
	RETURN ( __MKUINT(OLEOBJ_E_NOVERBS) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3296
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3297
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  3298
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3299
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3300
    ^ -1
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3301
! !
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
!Win32OperatingSystem class methodsFor:'executing OS commands'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3304
7066
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  3305
canExecuteCommand:aCommandString
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  3306
    "return true, if the OS can execute aCommand."
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  3307
8800
b1762fb45942 canExecuteCommand fixed
Claus Gittinger <cg@exept.de>
parents: 8792
diff changeset
  3308
"/    |fn|
b1762fb45942 canExecuteCommand fixed
Claus Gittinger <cg@exept.de>
parents: 8792
diff changeset
  3309
"/
b1762fb45942 canExecuteCommand fixed
Claus Gittinger <cg@exept.de>
parents: 8792
diff changeset
  3310
"/    fn := aCommandString asFilename.
b1762fb45942 canExecuteCommand fixed
Claus Gittinger <cg@exept.de>
parents: 8792
diff changeset
  3311
"/    ( #('com' 'exe') includes:fn suffix) ifFalse:[^ false].
7066
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  3312
    ^ super canExecuteCommand:aCommandString
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  3313
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  3314
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3315
     OperatingSystem canExecuteCommand:'fooBar'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3316
     OperatingSystem canExecuteCommand:'ls'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3317
     OperatingSystem canExecuteCommand:'cvs'
8843
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3318
     OperatingSystem canExecuteCommand:'diff'
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3319
     OperatingSystem canExecuteCommand:'cvs.exe'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3320
     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
  3321
     OperatingSystem canExecuteCommand:'C:\Windows\cvs.exe'
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
  3322
     OperatingSystem canExecuteCommand:'C:\Windows\system32\mspaint.exe'
7066
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  3323
    "
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  3324
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  3325
    "Created: 4.11.1995 / 19:13:54 / cg"
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  3326
!
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  3327
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3328
commandAndArgsForOSCommand:aCommandString
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3329
    "get a shell and shell arguments for command execution"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3330
11831
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3331
    |shell args wDir cmdName path hasRedirection|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3332
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3333
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3334
    "/ 'x:\WINNT\System32\cmd /c <command>'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3335
    "/ or 'x:\WINDOWS\System32\cmd /c <command>'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3336
    "/ or 'x:\WINDOWS\System\cmd /c <command>'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3337
    "/ or whatever ...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3338
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3339
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3340
    "/ to workaround a bug in win95's command.com
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3341
    "/ (which always returns a 0-exit code
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3342
    "/  - even if the command failed),
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3343
    "/ 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
  3344
    "/ call it directly if found.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3345
    "/ If not found, assume its a builtIn or batch command
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3346
    "/ and pass it to command.com.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3347
    "/ Also use command.com, if any I/O redirection is
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3348
    "/ involved, since that is (not yet) handled here.
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
    "/ I know: this is a kludge but should work for now...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3351
    "/ ...this will change in an upcoming version to include
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3352
    "/ command.com command-line parsing here (sigh).
11831
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3353
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3354
    hasRedirection := (aCommandString isNil or:[aCommandString includesAny:'<>|']).
7065
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  3355
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  3356
    hasRedirection ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3357
	"/ test whether the commandString is an executable;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3358
	"/ then, no shell is required
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3359
	cmdName := aCommandString withoutSeparators.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3360
	(cmdName notEmpty and:[(cmdName startsWith:$") not]) ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3361
	    |index file suffix|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3362
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3363
	    index := cmdName indexOfSeparatorStartingAt:1.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3364
	    index ~~ 0 ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3365
		args := cmdName copyFrom:(index+1).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3366
		cmdName := cmdName copyFrom:1 to:(index-1).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3367
	    ] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3368
		args := ''.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3369
	    ].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3370
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3371
	    file   := cmdName asFilename.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3372
	    suffix := file suffix.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3373
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3374
	    suffix isEmptyOrNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3375
		suffix := 'exe'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3376
		file := file withSuffix:suffix.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3377
	    ].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3378
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3379
	    (file exists and:[suffix = 'exe' or:[suffix = 'com']]) ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3380
		"/ is an executable, no shell required
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3381
		path := file fullAlternativePathName.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3382
		^ Array with:path with:aCommandString.
11831
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3383
"/                ^ Array with:path with:(path, ' ', args).
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3384
	    ].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3385
	    path := self pathOfCommand:cmdName.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3386
	    path notNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3387
		"/ is an executable, no shell required
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3388
		^ Array with:path with:aCommandString.
11831
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3389
"/                ^ Array with:path with:(path, ' ', args).
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3390
	    ].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3391
	].
11831
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3392
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3393
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3394
    shell := self getEnvironment:'COMSPEC'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3395
    shell isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3396
	wDir := self getWindowsSystemDirectory asFilename.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3397
	shell := #('cmd.exe' 'command.com') detect:[:eachCommand|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3398
			(wDir / eachCommand) isExecutable
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3399
		    ] ifNone:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3400
			self error:'no cmd.exe available'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3401
		    ].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3402
	shell := (wDir / shell) pathName.
12632
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
  3403
    ].
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
  3404
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
  3405
    aCommandString isEmptyOrNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3406
	^ Array with:shell with:nil
12632
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
  3407
    ].
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
  3408
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
  3409
    ^ Array with:shell with:(' /c "' , aCommandString, '"')
11831
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3410
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3411
   "
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3412
     self commandAndArgsForOSCommand:'diff'
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3413
     self commandAndArgsForOSCommand:'dir/w'
12632
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
  3414
     self commandAndArgsForOSCommand:'dir >nul:'
11831
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3415
   "
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3416
8349
b87b90e6d15a com-command generation (d-quotes in command-arg string)
Claus Gittinger <cg@exept.de>
parents: 8348
diff changeset
  3417
    "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
  3418
    "Modified: / 11-02-2007 / 20:51:08 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3419
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3420
7080
a82683bc1843 Cleanup closeDescriptor handling in exec:withArguments:...
Stefan Vogel <sv@exept.de>
parents: 7077
diff changeset
  3421
exec:aCommandPath withArguments:argString environment:environment fileDescriptors:fdArray fork:doFork newPgrp:newPgrp inDirectory:aDirectory
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3422
    "Internal lowLevel entry for combined fork & exec for WIN32
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3423
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3424
     If fork is false (chain a command):
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3425
	 execute the OS command specified by the argument, aCommandPath, with
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3426
	 arguments in argArray (no arguments, if nil).
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3427
	 If successful, this method does not return and smalltalk is gone.
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3428
	 If not successful, it does return.
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3429
	 Normal use is with forkForCommand.
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3430
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3431
     If fork is true (subprocess command execution):
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3432
	fork a child to do the above.
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3433
	The Win32ProcessHandle of the child process is returned; nil if the fork failed.
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3434
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3435
     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
  3436
	fdArray[1] = 15 -> use fd 15 as stdin.
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3437
	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
  3438
	will be closed for the child.
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3439
	fdArray[0] == StdIn for child
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3440
	fdArray[1] == StdOut for child
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3441
	fdArray[2] == StdErr for child
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3442
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3443
     NOTE that in WIN32 the fds are HANDLES.
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3444
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3445
     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
  3446
	The processgroup will be equal to id.
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3447
	newPgrp is not used on WIN32 and VMS systems."
11831
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3448
71349fc71208 Fix #executeCommand:
Stefan Vogel <sv@exept.de>
parents: 11811
diff changeset
  3449
    |dirPath rslt|
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3450
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3451
    aDirectory notNil ifTrue:[
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3452
	dirPath := aDirectory asFilename asAbsoluteFilename osNameForDirectory.
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3453
	(dirPath endsWith:':') ifTrue:[
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3454
	    dirPath := dirPath , '\'.
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3455
	].
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3456
    ].
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3457
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3458
    rslt := self
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3459
	primExec:aCommandPath
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3460
	commandLine:argString
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3461
	fileDescriptors:fdArray
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3462
	fork:doFork
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3463
	newPgrp:newPgrp
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3464
	inPath:dirPath
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3465
	createFlags:nil
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3466
	inheritHandles:true.
7841
c25e1dc957b8 debugPrint removed
ca
parents: 7840
diff changeset
  3467
c25e1dc957b8 debugPrint removed
ca
parents: 7840
diff changeset
  3468
"/ 'created ' print. cmdLine print. ' -> ' print. rslt printCR.
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3469
    ^ rslt
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3470
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3471
    "Modified: / 31.1.1998 / 10:54:24 / md"
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3472
    "Modified: / 15.5.1999 / 18:07:51 / cg"
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3473
!
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3474
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3475
getStatusOfProcess:aProcessId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3476
    "wait for a process to terminate and fetch its exit status.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3477
     This is required to avoid zombie processes."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3478
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3479
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3480
    DWORD endStatus;
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  3481
    INT status = -1;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3482
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3483
    if (__isExternalAddressLike(aProcessId)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3484
	HANDLE handle = _HANDLEVal(aProcessId);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3485
	if (handle) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3486
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3487
	    do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3488
		__threadErrno = 0;
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  3489
		endStatus = (INT)STX_API_CALL2( "WaitForSingleObject", WaitForSingleObject, handle, INFINITE);
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3490
	    } while ((endStatus < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3491
#else
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  3492
	    endStatus = (INT)WaitForSingleObject(handle , INFINITE);
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3493
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3494
	    if (endStatus != WAIT_FAILED) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3495
		if (GetExitCodeProcess(handle,&endStatus)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3496
		    status = endStatus;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3497
#ifdef PROCESSDEBUGWIN32
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3498
		    console_fprintf(stderr, "getexitcode status = %d\n",status);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3499
		} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3500
		    console_fprintf(stderr, "getexitcode failed.\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3501
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3502
		}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3503
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3504
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3505
	RETURN ( __mkSmallInteger(status));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3506
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3507
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3508
    self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3509
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3510
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3511
pathOfCommand:aCommand
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3512
    "find where aCommand's executable file is;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3513
     return its full pathName if there is such a command, otherwise
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3514
     return nil."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3515
13954
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3516
    |cmdFile path rentry rpath f fExt|
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3517
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3518
    cmdFile := aCommand asFilename.
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3519
    cmdFile isAbsolute ifTrue:[
14364
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3520
	cmdFile exists ifTrue:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3521
	    ^ aCommand
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3522
	].
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3523
	^ nil
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3524
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3525
10334
6fe7d98b0c7b care for executable to be under a subdir (debug\stx.exe)
Claus Gittinger <cg@exept.de>
parents: 10311
diff changeset
  3526
    (aCommand includes:Filename separator) ifTrue:[
14364
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3527
	path := Filename currentDirectory construct:aCommand.
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3528
	(path exists
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3529
	or:[ (path := path withSuffix:'com') exists
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3530
	or:[ (path := path withSuffix:'exe') exists ]]) ifTrue:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3531
	    path isExecutable ifTrue:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3532
		^ path pathName
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3533
	    ].
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3534
	].
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3535
	^ nil
13954
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3536
    ].
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3537
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3538
    path := (self getEnvironment:'PATH') ? ''.
13618
9af72c855037 Fixes for #canExecuteCommand:
vrany
parents: 13616
diff changeset
  3539
    (rentry := self registryEntry key: 'HKEY_CURRENT_USER\Environment') notNil ifTrue:[
14364
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3540
	rpath := rentry valueNamed: 'PATH'.
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3541
	rpath notNil ifTrue:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3542
	    path := path , self pathSeparator , rpath
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3543
	].
13954
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3544
    ].
13956
80a50d0484fb changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13954
diff changeset
  3545
    path := '.;',path.
13954
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3546
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3547
    (path asCollectionOfSubstringsSeparatedBy:(self pathSeparator)) do:[:eachDirectory |
14364
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3548
	eachDirectory isEmpty ifTrue:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3549
	    f := cmdFile
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3550
	] ifFalse:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3551
	    f := eachDirectory asFilename construct:aCommand.
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3552
	].
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3553
	f suffix isEmpty ifTrue:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3554
	    self executableFileExtensions do:[:ext |
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3555
		ext notEmpty ifTrue:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3556
		    fExt := (f pathName , '.' , ext) asFilename.
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3557
		] ifFalse:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3558
		    fExt := f.
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3559
		].
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3560
		fExt isExecutable ifTrue:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3561
		    ^ fExt pathName
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3562
		].
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3563
	    ].
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3564
	] ifFalse:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3565
	    f isExecutable ifTrue:[
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3566
		^ f pathName
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3567
	    ].
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  3568
	].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3569
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3570
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3571
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3572
    "windows:
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3573
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3574
     OperatingSystem pathOfCommand:'bcc32'
8843
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3575
     OperatingSystem pathOfCommand:'diff'
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  3576
     OperatingSystem pathOfCommand:'cvs'
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  3577
     OperatingSystem pathOfCommand:'cvs.exe'
13954
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3578
     OperatingSystem pathOfCommand:'stx.exe'
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3579
     OperatingSystem pathOfCommand:'stx'
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3580
    "
3ecd17f19f84 changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13790
diff changeset
  3581
13618
9af72c855037 Fixes for #canExecuteCommand:
vrany
parents: 13616
diff changeset
  3582
    "Modified: / 23-08-2011 / 21:11:47 / jv"
13956
80a50d0484fb changed: #pathOfCommand:
Claus Gittinger <cg@exept.de>
parents: 13954
diff changeset
  3583
    "Modified: / 20-01-2012 / 13:32:55 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3584
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3585
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3586
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
  3587
    "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
  3588
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3589
    |handle|
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3590
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3591
    handle := Win32ProcessHandle new.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3592
%{
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3593
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3594
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3595
     * if fork is false, chain to another command (not yet supported)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3596
     * otherwise, spawn a subprocess and let it execute the command.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3597
     * Currently, only the forking version is supported (who chains anyway ?)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3598
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3599
    char *cmdPath = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3600
    char *cmdLine = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3601
    char *dir = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3602
    DWORD               fdwCreate = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3603
    STARTUPINFO         lpsiStartInfo;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3604
    PROCESS_INFORMATION lppiProcInfo;
13112
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3605
    SECURITY_ATTRIBUTES securityAttributes;
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3606
    SECURITY_DESCRIPTOR securityDescriptor;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3607
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  3608
    if ((__isStringLike(commandPath) || (commandPath == nil)) && __isStringLike(commandLine)) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3609
	HANDLE stdinHandle = NULL;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3610
	HANDLE stdoutHandle = NULL;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3611
	HANDLE stderrHandle = NULL;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3612
	int mustClose_stdinHandle = 0;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3613
	int mustClose_stdoutHandle = 0;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3614
	int mustClose_stderrHandle = 0;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3615
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3616
	if (commandPath != nil) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3617
	    cmdPath = __stringVal(commandPath);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3618
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3619
	cmdLine = __stringVal(commandLine);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3620
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3621
	if (__isStringLike(dirName)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3622
	    dir = __stringVal(dirName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3623
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3624
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3625
	/*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3626
	 * create descriptors as req'd
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3627
	 */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3628
	memset(&securityAttributes, 0, sizeof(securityAttributes));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3629
	securityAttributes.nLength = sizeof(securityAttributes);
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3630
	securityAttributes.bInheritHandle = (inheritHandles == true) ? TRUE : FALSE;
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3631
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3632
	InitializeSecurityDescriptor(&securityDescriptor, SECURITY_DESCRIPTOR_REVISION);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3633
	SetSecurityDescriptorDacl(&securityDescriptor, -1, 0, 0);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3634
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3635
	securityAttributes.lpSecurityDescriptor = &securityDescriptor;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3636
	memset(&lppiProcInfo, 0, sizeof (lppiProcInfo));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3637
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3638
	memset(&lpsiStartInfo, 0, sizeof(lpsiStartInfo));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3639
	lpsiStartInfo.cb                = sizeof(lpsiStartInfo);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3640
	lpsiStartInfo.lpReserved        = NULL;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3641
	lpsiStartInfo.lpDesktop         = NULL;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3642
	lpsiStartInfo.lpTitle           = NULL;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3643
	lpsiStartInfo.dwX               = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3644
	lpsiStartInfo.dwY               = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3645
	lpsiStartInfo.dwXSize           = 100;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3646
	lpsiStartInfo.dwYSize           = 100;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3647
	lpsiStartInfo.dwXCountChars     = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3648
	lpsiStartInfo.dwYCountChars     = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3649
	lpsiStartInfo.dwFillAttribute   = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3650
	if (0 /*__isWinNT*/) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3651
	    lpsiStartInfo.dwFlags           = STARTF_USESTDHANDLES;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3652
	    lpsiStartInfo.wShowWindow       = SW_SHOWDEFAULT;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3653
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3654
	    lpsiStartInfo.dwFlags           = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES /*| STARTF_USEPOSITION*/;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3655
	    lpsiStartInfo.wShowWindow       = SW_HIDE /*SW_SHOWDEFAULT*/;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3656
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3657
	lpsiStartInfo.cbReserved2       = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3658
	lpsiStartInfo.lpReserved2       = NULL;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3659
	lpsiStartInfo.hStdInput         = NULL;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3660
	lpsiStartInfo.hStdOutput        = NULL;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3661
	lpsiStartInfo.hStdError         = NULL;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3662
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3663
	/*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3664
	 * set create process flags
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3665
	 * if the flags arg is nil, use common defaults;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3666
	 * if non-nil, it must be a positive integer containing the fdwCreate bits.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3667
	 */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3668
	if (flagsOrNil != nil) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3669
	    fdwCreate = __longIntVal(flagsOrNil);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3670
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3671
	    if (0 /* __isWinNT */)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3672
		fdwCreate = 0; //IDLE_PRIORITY_CLASS;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3673
	    else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3674
		fdwCreate = CREATE_NEW_CONSOLE; //|IDLE_PRIORITY_CLASS; // DETACHED_PROCESS; // NORMAL_PRIORITY_CLASS ;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3675
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3676
	    if (newPgrp == true) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3677
		fdwCreate |= CREATE_NEW_PROCESS_GROUP;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3678
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3679
	    fdwCreate |= CREATE_DEFAULT_ERROR_MODE;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3680
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3681
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3682
	if (fdArray == nil) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3683
	    stdinHandle  = (HANDLE) _get_osfhandle (0);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3684
	    stdoutHandle = (HANDLE) _get_osfhandle (1);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3685
	    stderrHandle  = (HANDLE) _get_osfhandle (2);
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3686
	} else if (__isArrayLike(fdArray) && (__arraySize(fdArray) >= 3)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3687
	    if (__ArrayInstPtr(fdArray)->a_element[0] != nil) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3688
		if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[0])) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3689
		    stdinHandle = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[0]);
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3690
		} else {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3691
		    stdinHandle = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[0]));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3692
		}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3693
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3694
	    if (__ArrayInstPtr(fdArray)->a_element[1] != nil) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3695
		if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[1])) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3696
		    stdoutHandle = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[1]);
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3697
		} else {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3698
		    stdoutHandle = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[1]));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3699
		}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3700
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3701
	    if (__ArrayInstPtr(fdArray)->a_element[2] != nil) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3702
		if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[2])) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3703
		    stderrHandle  = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[2]);
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3704
		} else {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3705
		    stderrHandle = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[2]));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3706
		}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3707
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3708
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3709
	    console_fprintf(stderr, "Win32OS [warning]: bad fd arg in createProcess\n");
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
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3712
#if defined(PROCESSDEBUGWIN32)
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3713
	console_fprintf(stderr, "stdin %x\n", stdinHandle);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3714
	console_fprintf(stderr, "stdout %x\n", stdoutHandle);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3715
	console_fprintf(stderr, "stderr %x\n", stderrHandle);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3716
#endif
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3717
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3718
	{
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3719
	    HANDLE childHandle;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3720
	    int sameHandle = (stdoutHandle == stderrHandle);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3721
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3722
	    // these MUST be inheritable!
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3723
	    if (stdinHandle) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3724
#if 0
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3725
		if (SetHandleInformation(stdinHandle, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT)) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3726
		    // good
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3727
		} else {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3728
		    console_fprintf(stderr, "Win32OS [warning]: SetHandleInformation failed in createProcess\n");
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3729
		}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3730
#else
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3731
		if (DuplicateHandle(GetCurrentProcess(), stdinHandle, GetCurrentProcess(),
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3732
				      &childHandle, 0, TRUE, DUPLICATE_SAME_ACCESS)) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3733
		    stdinHandle = childHandle;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3734
		    mustClose_stdinHandle = 1;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3735
		} else {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3736
		    console_fprintf(stderr, "Win32OS [warning]: duplicateHandle failed in createProcess\n");
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3737
		}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3738
#endif
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3739
	    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3740
	    if (stdoutHandle) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3741
#if 0
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3742
		if (SetHandleInformation(stdoutHandle, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT)) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3743
		    // good
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3744
		} else {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3745
		    console_fprintf(stderr, "Win32OS [warning]: SetHandleInformation failed in createProcess\n");
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3746
		}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3747
#else
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3748
		if (DuplicateHandle(GetCurrentProcess(), stdoutHandle, GetCurrentProcess(),
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3749
				      &childHandle, 0, TRUE, DUPLICATE_SAME_ACCESS)) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3750
		    stdoutHandle = childHandle;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3751
		    mustClose_stdoutHandle = 1;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3752
		} else {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3753
		    console_fprintf(stderr, "Win32OS [warning]: duplicateHandle failed in createProcess\n");
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3754
		}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3755
#endif
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3756
	    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3757
	    if (stderrHandle) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3758
		if (sameHandle) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3759
		    stderrHandle = stdoutHandle;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3760
		} else {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3761
#if 0
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3762
		    if (SetHandleInformation(stderrHandle, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT)) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3763
			// good
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3764
		    } else {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3765
			console_fprintf(stderr, "Win32OS [warning]: SetHandleInformation failed in createProcess\n");
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3766
		    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3767
#else
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3768
		    if (DuplicateHandle(GetCurrentProcess(), stderrHandle, GetCurrentProcess(),
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3769
					  &childHandle, 0, TRUE, DUPLICATE_SAME_ACCESS)) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3770
			stderrHandle = childHandle;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3771
			mustClose_stderrHandle = 1;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3772
		    } else {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3773
			console_fprintf(stderr, "Win32OS [warning]: duplicateHandle failed in createProcess\n");
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3774
		    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3775
#endif
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3776
		}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3777
	    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3778
	}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3779
	lpsiStartInfo.hStdInput  = stdinHandle;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3780
	lpsiStartInfo.hStdOutput = stdoutHandle;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3781
	lpsiStartInfo.hStdError  = stderrHandle;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3782
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3783
	if (doFork == true) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3784
#ifdef PROCESSDEBUGWIN32
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3785
	    console_fprintf(stderr, "create process cmdPath:<%s> cmdLine:<%s> in <%s>\n", cmdPath, cmdLine, dir);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3786
#endif
13790
cbd36ac7255e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13786
diff changeset
  3787
	    if (CreateProcessA( cmdPath,
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3788
				cmdLine,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3789
				&securityAttributes, NULL /* &securityAttributes */,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3790
				securityAttributes.bInheritHandle,      /* inherit handles */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3791
				fdwCreate | CREATE_SUSPENDED,           /* resume after setting affinity */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3792
				NULL,                                   /* env */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3793
				dir,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3794
				&lpsiStartInfo,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3795
				&lppiProcInfo ))
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3796
	    {
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  3797
		DWORD_PTR processAffinityMask, systemAffinityMask;
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3798
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3799
		/*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3800
		 * Process was created suspended, now set the affinity mask
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3801
		 * to any processor, and resume the processes main thread.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3802
		 * (librun/process.s limited the affinity to a single processor).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3803
		 */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3804
		GetProcessAffinityMask(lppiProcInfo.hProcess, &processAffinityMask, &systemAffinityMask);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3805
		SetProcessAffinityMask(lppiProcInfo.hProcess, systemAffinityMask);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3806
		if ((fdwCreate & CREATE_SUSPENDED) == 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3807
		    ResumeThread(lppiProcInfo.hThread);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3808
		}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3809
		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
  3810
15547
088a34ccacb1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15546
diff changeset
  3811
#if 0
088a34ccacb1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15546
diff changeset
  3812
		// only works with real console handles
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3813
		{
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3814
		    // change the child's stdIn (console) mode
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3815
		    DWORD mode = 0;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3816
15546
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  3817
		    if (! GetConsoleMode(stdinHandle, &mode)) {
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  3818
			console_fprintf(stderr, "Win32OS [warning]: GetConsoleMode failed in createProcess\n");
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  3819
		    }
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  3820
		    if (! SetConsoleMode(stdinHandle, mode & (~ENABLE_ECHO_INPUT))){
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  3821
			console_fprintf(stderr, "Win32OS [warning]: SetConsoleMode failed in createProcess\n");
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  3822
		    }
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3823
		}
15547
088a34ccacb1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15546
diff changeset
  3824
#endif
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3825
		if (mustClose_stdinHandle) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3826
		    CloseHandle(stdinHandle);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3827
		}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3828
		if (mustClose_stdoutHandle) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3829
		    CloseHandle(stdoutHandle);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3830
		}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3831
		if (mustClose_stderrHandle) {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3832
		    CloseHandle(stderrHandle);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3833
		}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3834
#ifdef PROCESSDEBUGWIN32
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3835
		console_fprintf(stderr, "created process hProcess=%x\n", lppiProcInfo.hProcess);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3836
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3837
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3838
		__externalAddressVal(handle) = lppiProcInfo.hProcess;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3839
		((struct __Win32OperatingSystem__Win32ProcessHandle_struct *)(handle))->pid = __mkSmallInteger(lppiProcInfo.dwProcessId);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3840
		RETURN (handle);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3841
	    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3842
#ifdef PROCESSDEBUGWIN32
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3843
	    console_fprintf(stderr, "created process error %d\n", GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3844
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3845
	    RETURN (nil);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3846
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3847
	    ; /* should never be called that way */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  3848
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3849
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3850
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3851
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3852
     path-argument not string
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3853
     or argArray not an array/nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3854
     or malloc failed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3855
     or not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3856
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3857
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3858
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3859
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  3860
shellExecute:hwndArg lpOperation:lpOperationArg lpFile:lpFileArg lpParameters:lpParametersArg lpDirectory:lpDirectoryArg nShowCmd:nShowCmd
13112
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3861
    "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
  3862
     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
  3863
     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
  3864
     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
  3865
		  or nil for the current directory."
13159
04ecf0207585 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13128
diff changeset
  3866
04ecf0207585 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13128
diff changeset
  3867
    |errorNumber handle|
04ecf0207585 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13128
diff changeset
  3868
04ecf0207585 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13128
diff changeset
  3869
    handle := Win32ProcessHandle new.
13112
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3870
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3871
%{
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3872
    SHELLEXECUTEINFO shExecInfo = {0};
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3873
    shExecInfo.cbSize = sizeof(shExecInfo);
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3874
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3875
    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
  3876
	shExecInfo.nShow = __intVal(nShowCmd);
13112
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3877
    } else {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3878
	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
  3879
	    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
  3880
	} 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
  3881
	    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
  3882
	} 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
  3883
	    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
  3884
	} 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
  3885
	    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
  3886
	} 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
  3887
	    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
  3888
	} 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
  3889
	    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
  3890
	} 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
  3891
	    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
  3892
	} 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
  3893
	    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
  3894
	} 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
  3895
	    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
  3896
	} 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
  3897
	    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
  3898
	} else {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3899
	    goto badArgument;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3900
	}
13112
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3901
    }
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  3902
    if (((lpOperationArg == nil) || __isStringLike(lpOperationArg))
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  3903
     && ((lpFileArg == nil) || __isStringLike(lpFileArg))
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  3904
     && ((lpParametersArg == nil) || __isStringLike(lpParametersArg))
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  3905
     && ((lpDirectoryArg == nil) || __isStringLike(lpDirectoryArg))
13112
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3906
    ) {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3907
	// 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
  3908
	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
  3909
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3910
	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
  3911
	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
  3912
	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
  3913
	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
  3914
	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
  3915
	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
  3916
	    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
  3917
		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
  3918
	    } else
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3919
		goto badArgument;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3920
	}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3921
	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
  3922
	    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
  3923
		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
  3924
		/*
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3925
		 * 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
  3926
		 * 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
  3927
		 * (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
  3928
		 */
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3929
		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
  3930
		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
  3931
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3932
		// 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
  3933
		// __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
  3934
		// RETURN (handle);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3935
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3936
		// old:
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3937
		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
  3938
		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
  3939
	    } else {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3940
		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
  3941
	    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3942
	} else {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3943
	    /* error */
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3944
	    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
  3945
	}
13112
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3946
    }
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3947
badArgument: ;
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3948
%}.
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3949
    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
  3950
	self primitiveFailed:'invalid argument(s)'.
13112
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3951
    ] ifFalse:[
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3952
	(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
  3953
	    parameter:lpFileArg;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3954
	    reportError
13112
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3955
    ].
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3956
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3957
    "
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3958
     self
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3959
	shellExecute:nil
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3960
	lpOperation:'open'
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3961
	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
  3962
	lpParameters:nil
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3963
	lpDirectory:nil
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3964
	nShowCmd:#SW_SHOWNORMAL
13112
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3965
    self
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3966
	shellExecute:nil
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3967
	lpOperation:'explore'
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3968
	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
  3969
	lpParameters:nil
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3970
	lpDirectory:nil
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  3971
	nShowCmd:#SW_SHOWNORMAL
13112
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3972
    "
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3973
!
1e8a1756693d changed:
Stefan Vogel <sv@exept.de>
parents: 13108
diff changeset
  3974
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3975
startProcess:aCommandString inputFrom:anExternalInStream outputTo:anExternalOutStream
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3976
    errorTo:anExternalErrStream auxFrom:anAuxiliaryStream
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3977
    environment:anEvironmentDictionary inDirectory:dir
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3978
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3979
    "start executing the OS command as specified by the argument, aCommandString
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3980
     as a separate process; do not wait for the command to finish.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3981
     The commandString is passed to a shell for execution - see the description of
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3982
     'sh -c' in your UNIX manual ('cmd.com' in your MSDOS manual).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3983
     The command gets stdIn, stdOut and stdErr assigned from the arguments;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3984
     each may be nil.
13315
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  3985
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  3986
     Return the Win32ProcessHandle if successful, nil otherwise.
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  3987
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3988
     Use #monitorPid:action: for synchronization and exec status return,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3989
     or #killProcess: to stop it."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3990
15598
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  3991
    |shellAndArgs nullStream in out err rslt|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3992
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3993
    aCommandString isNil ifTrue:[^ nil].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3994
    shellAndArgs := self commandAndArgsForOSCommand:aCommandString.
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3995
15598
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  3996
    (in := anExternalInStream) isNil ifTrue:[
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3997
	nullStream := Filename nullDevice readWriteStream.
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  3998
	in := nullStream.
15598
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  3999
    ].
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  4000
    (out := anExternalOutStream) isNil ifTrue:[
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  4001
	nullStream isNil ifTrue:[nullStream := Filename nullDevice writeStream].
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  4002
	out := nullStream.
15598
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  4003
    ].
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  4004
    (err := anExternalErrStream) isNil ifTrue:[
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  4005
	err := out
15598
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  4006
    ].
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  4007
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  4008
    rslt := self
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  4009
	exec:(shellAndArgs at:1)
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  4010
	withArguments:(shellAndArgs at:2)
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  4011
	environment:anEvironmentDictionary
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  4012
	fileDescriptors:(Array with:in fileHandle
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  4013
			       with:out fileHandle
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  4014
			       with:err fileHandle
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  4015
			       with:(anAuxiliaryStream notNil ifTrue:[anAuxiliaryStream fileHandle] ifFalse:[nil]))
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  4016
	fork:true
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  4017
	newPgrp:true
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  4018
	inDirectory:dir.
15598
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  4019
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  4020
    nullStream notNil ifTrue:[
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  4021
	nullStream close.
15598
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  4022
    ].
67c387228a4e class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15580
diff changeset
  4023
    ^ rslt
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4024
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4025
    "blocking at current prio (i.e. only higher prio threads execute):
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4026
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4027
     OperatingSystem executeCommand:'ls -l > out'.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4028
    "
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4029
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4030
    "non-blocking (lower prio threads continue):
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4031
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4032
     |in out err pid sema|
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4033
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4034
     in := 'out' asFilename readStream.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4035
     out := 'out2' asFilename writeStream.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4036
     err := 'err' asFilename writeStream.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4037
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4038
     sema := Semaphore new.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4039
     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
  4040
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4041
     The following will no longer work. monitorPid has disappeared
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4042
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4043
     pid notNil ifTrue:[
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
  4044
	 Processor monitorPid:pid action:[:OSstatus | sema signal ].
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4045
     ].
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4046
     in close.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4047
     out close.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4048
     err close.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4049
     sema wait.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4050
     Transcript showCR:'finished'
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4051
    "
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  4052
8349
b87b90e6d15a com-command generation (d-quotes in command-arg string)
Claus Gittinger <cg@exept.de>
parents: 8348
diff changeset
  4053
    "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
  4054
    "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
  4055
    "Created: / 12-11-1998 / 14:39:20 / cg"
10386
491685fba02e command execution (no need for command.com when executable
Claus Gittinger <cg@exept.de>
parents: 10373
diff changeset
  4056
    "Modified: / 11-02-2007 / 20:13:28 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4057
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4058
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4059
!Win32OperatingSystem class methodsFor:'file access'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4060
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  4061
closeFd:anIntegerOrHandle
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4062
    "low level close of a filedescriptor"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4063
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4064
%{
12686
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  4065
    if (__isSmallInteger(anIntegerOrHandle)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4066
	close(__intVal(anIntegerOrHandle));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4067
	RETURN(self);
12686
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  4068
    }
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  4069
    if (__isExternalAddressLike(anIntegerOrHandle)) {
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  4070
       if (!CloseHandle( __externalAddressVal(anIntegerOrHandle))) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4071
	   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
  4072
       }
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  4073
       RETURN(self);
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  4074
    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4075
%}.
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  4076
    ^ self primitiveFailed.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4077
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4078
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4079
createDirectory:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4080
    "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
  4081
     path, or relative to the current directory.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4082
     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
  4083
     This is a low-level entry - use Filename protocol for compatibility."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4084
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4085
    "/ if it already exists this is ok
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4086
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4087
    (self isDirectory:aPathName) ifTrue:[^ true].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4088
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4089
%{
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4090
    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
  4091
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4092
    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
  4093
    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
  4094
    // 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
  4095
    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
  4096
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  4097
    if (__isStringLike(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4098
	int ret;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4099
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4100
	ret = CreateDirectoryA(__stringVal(aPathName), &sa);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4101
	if (ret != TRUE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4102
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4103
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4104
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4105
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4106
	RETURN (true);
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4107
    }
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4108
    if (__isUnicode16String(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4109
	int ret;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4110
	wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4111
	int i, l;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4112
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4113
	l = __unicode16StringSize(aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4114
	if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4115
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4116
	    _wPathName[i] = __unicode16StringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4117
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4118
	_wPathName[i] = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4119
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4120
	ret = CreateDirectoryW(_wPathName, &sa);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4121
	if (ret != TRUE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4122
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4123
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4124
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4125
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4126
	RETURN (true);
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4127
    }
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4128
%}.
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4129
    ^ self primitiveFailed
5133
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
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4132
     OperatingSystem createDirectory:'foo'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4133
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4134
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4135
    "Modified: 20.12.1995 / 11:24:13 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4136
    "Modified: 29.6.1996 / 14:06:54 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4137
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4138
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4139
createFileForReadAppend:pathName
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4140
     ^ self openFile:pathName attributes:#(#'GENERIC_READ' #'GENERIC_WRITE')
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4141
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4142
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4143
createFileForReadWrite:pathName
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  4144
     ^ self openFile:pathName attributes:#(#'GENERIC_READ' #'GENERIC_WRITE' #'CREATE_ALWAYS')
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4145
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4146
13224
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4147
createHardLinkFrom:oldPath to:newPath
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4148
    "link the file 'oldPath' to 'newPath'. The link will be a hard link.
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4149
     Return true if successful, false if not."
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4150
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4151
    self executeCommand:('mklink/h "%1" "%2"' bindWith:newPath with:oldPath)
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4152
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4153
    "Created: / 19-01-2011 / 08:42:11 / cg"
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4154
!
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4155
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4156
createSymbolicLinkFrom:oldPath to:newPath
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4157
    "make a link from the file 'oldPath' to the file 'newPath'.
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4158
     The link will be a soft (symbolic) link.
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4159
     Return true if successful, false if not."
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4160
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4161
    self executeCommand:('mklink "%1" "%2"' bindWith:newPath with:oldPath)
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4162
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4163
    "Created: / 19-01-2011 / 08:41:44 / cg"
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4164
!
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4165
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4166
getLastError
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4167
%{
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4168
    RETURN ( __mkSmallInteger( __WIN32_ERR(GetLastError()) ));
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4169
%}.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4170
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4171
    "Created: / 31-07-2006 / 12:40:39 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4172
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  4173
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4174
getLinkTarget:aPathName
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4175
    "given a filename, which represents a link-file (.lnk),
10161
fd6b02ffb383 avoid recursion
Claus Gittinger <cg@exept.de>
parents: 10160
diff changeset
  4176
     return its resolved path, or nil"
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4177
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4178
    |resolvedPath|
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4179
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4180
%{  /* STACK:100000 */
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4181
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4182
    static IShellLink   * ipShellLink   = NULL;
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4183
    static IPersistFile * ipPersistFile = NULL;
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4184
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4185
    HRESULT hres;
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4186
    WIN32_FIND_DATA wfd;
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  4187
    WORD wsz[MAXPATHLEN];
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  4188
    char szGotPath[MAXPATHLEN];
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  4189
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  4190
    if (! __isStringLike(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4191
	console_fprintf(stderr, "OperatingSystem [info]: invalid argument\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4192
	goto error;
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4193
    }
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4194
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4195
    if( ! coInitialized ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4196
	console_fprintf(stderr, "OperatingSystem [info]: com not initialized\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4197
	goto error;
11193
a432bfa95db0 CoInitialize -> coInitializeEx(MULTITHREADED)
Claus Gittinger <cg@exept.de>
parents: 11135
diff changeset
  4198
    }
a432bfa95db0 CoInitialize -> coInitializeEx(MULTITHREADED)
Claus Gittinger <cg@exept.de>
parents: 11135
diff changeset
  4199
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4200
    if ( ipShellLink == NULL ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4201
	hres = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4202
				&IID_IShellLink, (LPVOID *)&ipShellLink);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4203
	if (! SUCCEEDED(hres)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4204
	    console_fprintf(stderr, "OperatingSystem [info]: CoCreateInstance Error - hres = %08x\n", hres);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4205
	    ipShellLink = NULL;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4206
	    goto error;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4207
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4208
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4209
	hres = ipShellLink->lpVtbl->QueryInterface( ipShellLink, &IID_IPersistFile, (void **)&ipPersistFile );
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4210
	if (! SUCCEEDED(hres)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4211
	    console_fprintf(stderr, "OperatingSystem [info]: QueryInterface Error - hres = %08x\n", hres);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4212
	    ipShellLink->lpVtbl->Release(ipShellLink);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4213
	    ipShellLink   = NULL;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4214
	    ipPersistFile = NULL;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4215
	    goto error;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4216
	}
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4217
    }
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4218
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  4219
    MultiByteToWideChar(CP_ACP, 0, __stringVal(aPathName), -1, wsz, MAXPATHLEN);
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4220
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4221
    hres = ipPersistFile->lpVtbl->Load(ipPersistFile, wsz, STGM_READ);
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4222
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4223
    if (SUCCEEDED(hres)) {
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  4224
	hres = ipShellLink->lpVtbl->GetPath(ipShellLink, szGotPath, MAXPATHLEN,
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4225
		    (WIN32_FIND_DATA *)&wfd, 0 /* SLGP_SHORTPATH */ );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4226
	if (SUCCEEDED(hres)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4227
	    resolvedPath = __MKSTRING(szGotPath);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4228
	} else {
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4229
#ifdef COM_DEBUG
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4230
	    console_fprintf(stderr, "OperatingSystem [info]: GetPath failed - hres = %08x\n", hres );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4231
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4232
	}
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4233
    } else {
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4234
#ifdef COM_DEBUG
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4235
	console_fprintf(stderr, "OperatingSystem [info]: Load failed - hres = %08x\n", hres );
11253
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4236
#endif
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4237
    }
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4238
    /* ipPersistFile->lpVtbl->Release(ipPersistFile);  */
ea6152cdf700 bugfix: #getLinkTarget: initialization of COM interface
ca
parents: 11247
diff changeset
  4239
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4240
error: ;
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4241
%}.
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4242
    resolvedPath notNil ifTrue:[^ resolvedPath ].
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4243
10373
92efacf8b050 getLinkTarget is now done lazyly.
Claus Gittinger <cg@exept.de>
parents: 10365
diff changeset
  4244
    "/ self primitiveFailed.
92efacf8b050 getLinkTarget is now done lazyly.
Claus Gittinger <cg@exept.de>
parents: 10365
diff changeset
  4245
    ^ nil.
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4246
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4247
    "
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4248
     OperatingSystem getLinkTarget:'C:\Dokumente und Einstellungen\cg\Favoriten\Incoming.lnk'
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4249
     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
  4250
    "
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4251
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4252
    "Created: / 07-11-2006 / 10:52:44 / cg"
10373
92efacf8b050 getLinkTarget is now done lazyly.
Claus Gittinger <cg@exept.de>
parents: 10365
diff changeset
  4253
    "Modified: / 07-02-2007 / 10:37:48 / cg"
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4254
!
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  4255
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4256
linkFile:oldPath to:newPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4257
    "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
  4258
     Return true if successful, false if not."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4259
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4260
    (oldPath isString not or:[newPath isString not]) ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4261
	"/
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4262
	"/ bad argument(s) given
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4263
	"/
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4264
	^ self primitiveFailed
13224
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4265
    ].
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4266
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4267
    ^ self createHardLinkFrom:oldPath to:newPath
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4268
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4269
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4270
     OperatingSystem linkFile:'foo' to:'bar'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4271
    "
13224
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4272
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
  4273
    "Modified: / 19-01-2011 / 08:42:53 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4274
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4275
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4276
openFile:pathName attributes:attributeSpec
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4277
    "non public internal helper.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4278
     open a file, return an os specific fileHandle.
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4279
     attributes is a collection of symbols specifying how the file is
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4280
     to be opened."
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4281
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  4282
    |fileHandle errorNumber argumentError|
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4283
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4284
    fileHandle := Win32Handle new.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4285
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4286
%{
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4287
    HANDLE h;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4288
    char *name;
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4289
    wchar_t _wPathName[MAXPATHLEN+1];
11810
24927b757d9b Fix for bad arguments
Stefan Vogel <sv@exept.de>
parents: 11804
diff changeset
  4290
    OBJ *ap;
24927b757d9b Fix for bad arguments
Stefan Vogel <sv@exept.de>
parents: 11804
diff changeset
  4291
    int numAttrib;
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4292
    int i, l;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4293
    DWORD access, share, create, attr;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4294
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  4295
    if (__isStringLike(pathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4296
	name = __stringVal(pathName);
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4297
    } else if (__isUnicode16String(pathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4298
	l = __unicode16StringSize(pathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4299
	if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4300
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4301
	    _wPathName[i] = __unicode16StringVal(pathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4302
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4303
	_wPathName[i] = 0;
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4304
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4305
	fileHandle = nil;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4306
	argumentError = @symbol(badPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4307
	goto badArgument;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4308
    }
11810
24927b757d9b Fix for bad arguments
Stefan Vogel <sv@exept.de>
parents: 11804
diff changeset
  4309
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8912
diff changeset
  4310
    if (! __isArrayLike(attributeSpec)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4311
	fileHandle = nil;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4312
	argumentError = @symbol(badAttributeSpec);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4313
	goto badArgument;
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4314
    }
11810
24927b757d9b Fix for bad arguments
Stefan Vogel <sv@exept.de>
parents: 11804
diff changeset
  4315
    ap = __ArrayInstPtr(attributeSpec)->a_element;
24927b757d9b Fix for bad arguments
Stefan Vogel <sv@exept.de>
parents: 11804
diff changeset
  4316
    numAttrib = __arraySize(attributeSpec);
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4317
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4318
    share = 0;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4319
    access = 0;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4320
    create = 0;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4321
    attr = 0;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4322
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4323
    for (i=0; i<numAttrib;i++) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4324
	OBJ attrSym = ap[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4325
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4326
	if (attrSym == @symbol(FILE_SHARE_READ)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4327
	    share |= FILE_SHARE_READ;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4328
	} else if (attrSym == @symbol(FILE_SHARE_WRITE)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4329
	    share |= FILE_SHARE_WRITE;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4330
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4331
	} else if (attrSym == @symbol(GENERIC_READ)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4332
	    access |= GENERIC_READ;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4333
	} else if (attrSym == @symbol(GENERIC_WRITE)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4334
	    access |= GENERIC_WRITE;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4335
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4336
	} else if (attrSym == @symbol(CREATE_NEW)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4337
	    create |= CREATE_NEW;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4338
	} else if (attrSym == @symbol(CREATE_ALWAYS)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4339
	    create |= CREATE_ALWAYS;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4340
	} else if (attrSym == @symbol(OPEN_EXISTING)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4341
	    create |= OPEN_EXISTING;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4342
	} else if (attrSym == @symbol(OPEN_ALWAYS)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4343
	    create |= OPEN_ALWAYS;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4344
	} else if (attrSym == @symbol(TRUNCATE_EXISTING)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4345
	    create |= TRUNCATE_EXISTING;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4346
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4347
	} else if (attrSym == @symbol(FILE_ATTRIBUTE_HIDDEN)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4348
	    attr |= FILE_ATTRIBUTE_HIDDEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4349
	} else if (attrSym == @symbol(FILE_ATTRIBUTE_READONLY)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4350
	    attr |= FILE_ATTRIBUTE_READONLY;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4351
	} else if (attrSym == @symbol(FILE_ATTRIBUTE_READONLY)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4352
	    attr |= FILE_ATTRIBUTE_READONLY;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4353
	} else if (attrSym == @symbol(FILE_FLAG_WRITE_THROUGH)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4354
	    attr |= FILE_FLAG_WRITE_THROUGH;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4355
	} else if (attrSym == @symbol(FILE_FLAG_SEQUENTIAL_SCAN)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4356
	    attr |= FILE_FLAG_SEQUENTIAL_SCAN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4357
	} else if (attrSym == @symbol(FILE_FLAG_DELETE_ON_CLOSE)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4358
	    attr |= FILE_FLAG_DELETE_ON_CLOSE;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4359
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4360
	    console_fprintf(stderr, "Win32OS [warning]: unsupported open mode\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4361
	}
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4362
    }
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  4363
    if (create == 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4364
	fileHandle = nil;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4365
	argumentError = @symbol(missingCreateMode);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4366
	goto badArgument;
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  4367
    }
8792
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  4368
#ifdef PROCESSDEBUGWIN32
10352
f2e9bb8906db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10342
diff changeset
  4369
    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
  4370
		name, access, share, create, attr);
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4371
#endif
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  4372
    if (__isStringLike(pathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4373
	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
  4374
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4375
	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
  4376
    }
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4377
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4378
    if (h != INVALID_HANDLE_VALUE) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4379
	__externalAddressVal(fileHandle) = (void *)h;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4380
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4381
	fileHandle = nil;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4382
	errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4383
    }
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4384
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4385
badArgument: ;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4386
%}.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4387
    fileHandle notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4388
	fileHandle registerForFinalization.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4389
	^ fileHandle.
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4390
    ].
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4391
    errorNumber isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4392
	self error:'invalid argument(s): ', argumentError.
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4393
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4394
	(self errorHolderForNumber:errorNumber) reportError
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4395
    ].
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4396
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4397
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4398
openFileForAppend:pathName
8412
cb1f92123250 Fix getting home directory if it is on a network share.
Stefan Vogel <sv@exept.de>
parents: 8360
diff changeset
  4399
    "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
  4400
cb1f92123250 Fix getting home directory if it is on a network share.
Stefan Vogel <sv@exept.de>
parents: 8360
diff changeset
  4401
    ^ self shouldImplement
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4402
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4403
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4404
openFileForRead:pathName
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  4405
     ^ self openFile:pathName attributes:#(#'GENERIC_READ' #'OPEN_EXISTING')
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4406
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4407
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4408
openFileForReadAppend:pathName
8412
cb1f92123250 Fix getting home directory if it is on a network share.
Stefan Vogel <sv@exept.de>
parents: 8360
diff changeset
  4409
    "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
  4410
cb1f92123250 Fix getting home directory if it is on a network share.
Stefan Vogel <sv@exept.de>
parents: 8360
diff changeset
  4411
    ^ self shouldImplement
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4412
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4413
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4414
openFileForReadWrite:pathName
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4415
     ^ self openFile:pathName attributes:#(#'GENERIC_READ' #'GENERIC_WRITE')
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4416
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4417
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4418
openFileForWrite:pathName
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  4419
     ^ self openFile:pathName attributes:#(#'GENERIC_WRITE' #'OPEN_EXISTING')
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4420
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  4421
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4422
recursiveCopyDirectory:sourcePathName to:destination
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4423
    "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
  4424
     Return true if successful."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4425
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4426
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4427
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4428
    "Modified: / 4.6.1998 / 04:29:49 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4429
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4430
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4431
removeDirectory:fullPathName
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4432
    "remove the directory named 'fullPathName'.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4433
     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
  4434
     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
  4435
     This is a lowLevel entry - use Filename protocol for compatibility."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4436
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4437
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4438
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4439
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  4440
    if (__isStringLike(fullPathName)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4441
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4442
	{
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4443
	    char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4444
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4445
	    strncpy(_aPathName, __stringVal(fullPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4446
	    do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4447
		__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
  4448
		// do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4449
		ret = STX_API_NOINT_CALL1( "RemoveDirectoryA", RemoveDirectoryA, _aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4450
	    } while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4451
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4452
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4453
	ret = RemoveDirectoryA((char *)__stringVal(fullPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4454
	__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4455
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4456
	if (ret != TRUE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4457
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4458
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4459
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4460
	RETURN (true);
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4461
    }
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4462
    if (__isUnicode16String(fullPathName)) {
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4463
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4464
	{
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4465
	    wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4466
	    int i, l;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4467
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4468
	    l = __unicode16StringSize(fullPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4469
	    if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4470
	    for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4471
		_wPathName[i] = __unicode16StringVal(fullPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4472
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4473
	    _wPathName[i] = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4474
	    do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4475
		__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
  4476
		// do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4477
		ret = STX_API_NOINT_CALL1( "RemoveDirectoryW", RemoveDirectoryW, _wPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4478
	    } while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4479
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4480
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4481
	ret = RemoveDirectoryW((char *)__stringVal(fullPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4482
	__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4483
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4484
	if (ret != TRUE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4485
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4486
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4487
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4488
	RETURN (true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4489
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4490
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4491
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4492
    "/ either not a string argument,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4493
    "/ or not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4494
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4495
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4496
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4497
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4498
     OperatingSystem createDirectory:'foo'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4499
     OperatingSystem removeDirectory:'foo'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4500
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4501
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4502
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4503
removeFile:fullPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4504
    "remove the file named 'fullPathName'; return true if successful.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4505
     This is a lowLevel entry - use Filename protocol for compatibility."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4506
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4507
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4508
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4509
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  4510
    if (__isStringLike(fullPathName)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4511
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4512
	{
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4513
	    char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4514
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4515
	    strncpy(_aPathName, __stringVal(fullPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4516
	    do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4517
		__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
  4518
		// do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4519
		ret = STX_API_NOINT_CALL1( "DeleteFileA", DeleteFileA, _aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4520
	    } while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4521
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4522
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4523
	ret = DeleteFileA((char *)__stringVal(fullPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4524
	__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4525
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4526
	if (ret != TRUE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4527
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4528
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4529
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4530
	RETURN (true);
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4531
    }
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4532
    if (__isUnicode16String(fullPathName)) {
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4533
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4534
	{
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4535
	    wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4536
	    int i, l;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4537
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4538
	    l = __unicode16StringSize(fullPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4539
	    if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4540
	    for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4541
		_wPathName[i] = __unicode16StringVal(fullPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4542
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4543
	    _wPathName[i] = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4544
	    do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4545
		__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
  4546
		// do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4547
		ret = STX_API_NOINT_CALL1( "DeleteFileW", DeleteFileW, _wPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4548
	    } while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4549
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4550
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4551
	ret = DeleteFileW((char *)__stringVal(fullPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4552
	__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4553
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4554
	if (ret != TRUE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4555
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4556
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4557
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4558
	RETURN (true);
11617
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4559
    }
0b0ea0b5235e unicode support for removeFile, removeDirectory, createFile and createDirectory
Claus Gittinger <cg@exept.de>
parents: 11609
diff changeset
  4560
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4561
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4562
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4563
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4564
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4565
renameFile:oldPath to:newPath
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4566
    "rename the file 'oldPath' to 'newPath'.
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4567
     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
  4568
     correct for the OS used - therefore, this should not be called
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4569
     directlt. Instead, use Filename protocol to rename; this cares for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4570
     any invalid names.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4571
     Returns true if successful, false if not"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4572
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4573
%{
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4574
    int ret;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4575
    int eno;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4576
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  4577
    if (__isStringLike(oldPath) && __isStringLike(newPath)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4578
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4579
	char _oldPath[MAXPATHLEN], _newPath[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4580
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4581
	strncpy(_oldPath, __stringVal(oldPath), MAXPATHLEN-1); _oldPath[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4582
	strncpy(_newPath, __stringVal(newPath), MAXPATHLEN-1); _newPath[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4583
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4584
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4585
	    __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
  4586
	    // do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4587
	    ret = STX_C_NOINT_CALL2( "rename", rename, _oldPath, _newPath);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4588
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4589
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4590
	__BEGIN_INTERRUPTABLE__
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4591
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4592
	    __threadErrno = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4593
	    ret = rename((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4594
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4595
	__END_INTERRUPTABLE__
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4596
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4597
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4598
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4599
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4600
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4601
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4602
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4603
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4604
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4605
	RETURN (true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4606
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4607
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4608
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4609
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4610
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4611
     OperatingSystem renameFile:'foo' to:'bar'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4612
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4613
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4614
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4615
truncateFile:aPathName to:newSize
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4616
    "change a files size return true on success, false on failure.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4617
     This may not be supported on all architectures.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4618
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4619
     This is a low-level entry - use Filename protocol."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4620
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4621
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4622
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4623
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4624
!Win32OperatingSystem class methodsFor:'file access rights'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4625
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4626
accessMaskFor:aSymbol
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4627
    "return the access bits mask for numbers as returned by
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4628
     OperatingSystem>>accessModeOf:
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4629
     and expected by OperatingSystem>>changeAccessModeOf:to:.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4630
     Since these numbers are OS dependent, always use the mask
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4631
     (never hardcode 8rxxx into your code)."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4632
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4633
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4634
    /* posix systems should define these ... */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4635
#   ifndef S_IRUSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4636
#    define S_IRUSR 0400
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4637
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4638
#   ifndef S_IWUSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4639
#    define S_IWUSR 0200
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4640
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4641
#   ifndef S_IXUSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4642
#    define S_IXUSR 0100
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4643
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4644
#   ifndef S_IRGRP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4645
#    define S_IRGRP 0040
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4646
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4647
#   ifndef S_IWGRP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4648
#    define S_IWGRP 0020
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4649
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4650
#   ifndef S_IXGRP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4651
#    define S_IXGRP 0010
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4652
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4653
#   ifndef S_IROTH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4654
#    define S_IROTH 0004
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4655
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4656
#   ifndef S_IWOTH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4657
#    define S_IWOTH 0002
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4658
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4659
#   ifndef S_IXOTH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4660
#    define S_IXOTH 0001
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4661
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4662
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4663
    if (aSymbol == @symbol(readUser)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4664
	RETURN ( __mkSmallInteger(S_IRUSR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4665
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4666
    if (aSymbol == @symbol(writeUser)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4667
	RETURN ( __mkSmallInteger(S_IWUSR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4668
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4669
    if (aSymbol == @symbol(executeUser)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4670
	RETURN ( __mkSmallInteger(S_IXUSR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4671
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4672
    if (aSymbol == @symbol(readGroup)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4673
	RETURN ( __mkSmallInteger(S_IRGRP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4674
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4675
    if (aSymbol == @symbol(writeGroup)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4676
	RETURN ( __mkSmallInteger(S_IWGRP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4677
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4678
    if (aSymbol == @symbol(executeGroup)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4679
	RETURN ( __mkSmallInteger(S_IXGRP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4680
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4681
    if (aSymbol == @symbol(readOthers)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4682
	RETURN ( __mkSmallInteger(S_IROTH) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4683
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4684
    if (aSymbol == @symbol(writeOthers)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4685
	RETURN ( __mkSmallInteger(S_IWOTH) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4686
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4687
    if (aSymbol == @symbol(executeOthers)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4688
	RETURN ( __mkSmallInteger(S_IXOTH) );
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  4689
    }
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  4690
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  4691
    // 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
  4692
    // (but handle them for UNIX compatibility
1b41c869040a More file access mode definitions
Stefan Vogel <sv@exept.de>
parents: 10627
diff changeset
  4693
    if (aSymbol == @symbol(setUid)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4694
	RETURN ( __mkSmallInteger(0) );
10664
1b41c869040a More file access mode definitions
Stefan Vogel <sv@exept.de>
parents: 10627
diff changeset
  4695
    }
1b41c869040a More file access mode definitions
Stefan Vogel <sv@exept.de>
parents: 10627
diff changeset
  4696
    if (aSymbol == @symbol(setGid)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4697
	RETURN ( __mkSmallInteger(0) );
10664
1b41c869040a More file access mode definitions
Stefan Vogel <sv@exept.de>
parents: 10627
diff changeset
  4698
    }
1b41c869040a More file access mode definitions
Stefan Vogel <sv@exept.de>
parents: 10627
diff changeset
  4699
    if (aSymbol == @symbol(removeOnlyByOwner)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4700
	RETURN ( __mkSmallInteger(0) );
10664
1b41c869040a More file access mode definitions
Stefan Vogel <sv@exept.de>
parents: 10627
diff changeset
  4701
    }
1b41c869040a More file access mode definitions
Stefan Vogel <sv@exept.de>
parents: 10627
diff changeset
  4702
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4703
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4704
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4705
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4706
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4707
     OperatingSystem accessMaskFor:#readUser
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4708
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4709
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4710
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4711
accessModeOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4712
    "return a number representing access rights rwxrwxrwx for owner,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4713
     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
  4714
     Notice that the returned number is OS dependent - use the
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4715
     modeMasks as returned by OperatingSystem>>accessMaskFor:"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4716
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4717
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4718
     this could have been implemented as:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4719
	(self infoOf:aPathName) at:#mode
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4720
     but for huge directory searches the code below is faster
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4721
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4722
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4723
%{
10449
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  4724
    struct stat buf;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4725
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4726
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  4727
    if (__isStringLike(aPathName)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4728
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4729
	char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4730
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4731
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4732
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4733
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4734
	    __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
  4735
	    // do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4736
	    ret = STX_C_NOINT_CALL2( "stat", stat, _aPathName, &buf);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4737
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4738
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4739
	__BEGIN_INTERRUPTABLE__
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4740
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4741
	    __threadErrno = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4742
	    ret = stat( (char *)__stringVal(aPathName), &buf);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4743
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4744
	__END_INTERRUPTABLE__
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4745
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4746
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4747
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4748
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4749
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4750
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4751
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4752
	    RETURN ( nil );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4753
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4754
	RETURN ( __mkSmallInteger(buf.st_mode & 0777) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4755
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4756
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4757
   ^ self primitiveFailed
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
    (OperatingSystem accessModeOf:'/') printStringRadix:8
10449
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  4761
    (OperatingSystem accessModeOf:'Make.proto') printStringRadix:8
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  4762
    (OperatingSystem changeAccessModeOf:'Make.proto' to:8r644)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4763
   "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4764
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4765
15500
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4766
accessModeOfFd:aFileDescriptor
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4767
    "return a number representing access rights rwxrwxrwx for owner,
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4768
     group and others. Return nil if such a file does not exist.
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4769
     Notice that the returned number is OS dependent - use the
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4770
     modeMasks as returned by OperatingSystem>>accessMaskFor:"
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4771
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4772
    "
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4773
     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
  4774
	(self infoOf:aPathName) at:#mode
15500
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4775
     but for huge directory searches the code below is faster
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4776
    "
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4777
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4778
%{
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4779
    struct stat buf;
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4780
    int ret;
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4781
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4782
    if (__isSmallInteger(aFileDescriptor)) {
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4783
#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
  4784
	do {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4785
	    __threadErrno = 0;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4786
	    // 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
  4787
	    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
  4788
	} 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
  4789
#else
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4790
	__BEGIN_INTERRUPTABLE__
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4791
	do {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4792
	    __threadErrno = 0;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4793
	    // do not cast to INT - will loose sign bit then!
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4794
	    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
  4795
	} 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
  4796
	__END_INTERRUPTABLE__
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4797
	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
  4798
	    __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
  4799
	}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4800
#endif
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4801
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4802
	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
  4803
	    @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
  4804
	    RETURN ( nil );
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4805
	}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  4806
	RETURN ( __mkSmallInteger(buf.st_mode & 0777) );
15500
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4807
    }
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4808
%}.
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4809
   ^ self primitiveFailed
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4810
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4811
   "
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4812
    '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
  4813
	(OperatingSystem accessModeOfFd:s fileDescriptor) printStringRadix:8.
15500
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4814
    ].
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4815
    '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
  4816
	(OperatingSystem accessModeOfFd:s fileDescriptor) printStringRadix:8.
15500
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4817
    ].
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4818
    (OperatingSystem changeAccessModeOf:'Make.proto' to:8r644)
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4819
   "
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4820
!
f30ab7ce37d2 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15472
diff changeset
  4821
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4822
changeAccessModeOf:aPathName to:modeBits
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4823
    "change the access rights of aPathName to the OS dependent modeBits.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4824
     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
  4825
     independent. Return true if changed,
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4826
     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
  4827
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
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4830
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  4831
    if (__isStringLike(aPathName) && __isSmallInteger(modeBits)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4832
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4833
	int chmod();
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4834
	char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4835
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4836
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4837
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4838
	    __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
  4839
	    // do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4840
	    ret = STX_C_NOINT_CALL2( "chmod", chmod, _aPathName, __intVal(modeBits));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4841
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4842
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4843
	__BEGIN_INTERRUPTABLE__
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4844
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4845
	    __threadErrno = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4846
	    ret = chmod((char *)__stringVal(aPathName), __intVal(modeBits));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4847
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4848
	__END_INTERRUPTABLE__
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4849
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4850
	    __threadErrno = __WIN32_ERR(GetLastError());
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
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4853
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4854
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4855
	    RETURN ( false );
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
	RETURN ( true );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4858
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4859
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4860
    ^ self primitiveFailed
10449
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  4861
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  4862
   "
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  4863
    (OperatingSystem accessModeOf:'Make.proto') printStringRadix:8
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  4864
    (OperatingSystem changeAccessModeOf:'Make.proto' to:8r644)
41456eed5b53 chmod def for WIN32/msvc
Claus Gittinger <cg@exept.de>
parents: 10448
diff changeset
  4865
   "
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4866
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4867
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4868
!Win32OperatingSystem class methodsFor:'file dialogs'!
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4869
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4870
commDlgExtendedError
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4871
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4872
    <apicall: ulong "CommDlgExtendedError" () module: "comdlg32.dll" >
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4873
    ^self primitiveFailed
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4874
!
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4875
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4876
getOpenFilename: openFilenameStructureExternalAddress
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4877
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4878
    "Opens a windows native file dialog without blocking stx for an OpenFilenameStructure stored in an externalAddress.
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4879
    openFilenameStructureExternalAddress is an integer representing it's address"
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4880
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4881
    | rslt |
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4882
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4883
%{  /* STACK: 32000*/
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4884
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4885
    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
  4886
    int __rslt;
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4887
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4888
    if (__isExternalAddressLike(openFilenameStructureExternalAddress)
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4889
     || __isExternalBytesLike(openFilenameStructureExternalAddress)){ 
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4890
        __address = __externalAddressVal(openFilenameStructureExternalAddress);
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4891
        __rslt = __STX_API_CALL1( "GetOpenFileName", (void *)GetOpenFileName, __address);
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4892
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4893
        if (__rslt == TRUE) {
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4894
            rslt = true;
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4895
        } else {
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4896
            rslt = false;
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4897
        }
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4898
    }
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4899
%}.
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4900
    rslt isNil ifTrue:[ self primitiveFailed ].
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4901
    ^ rslt
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4902
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4903
    "Modified (format): / 11-02-2014 / 21:18:02 / cg"
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4904
!
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4905
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4906
getSaveFilename: openFilenameStructureExternalAddress
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4907
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4908
    "Opens a windows native file dialog without blocking stx for an OpenFilenameStructure stored in an externalAddress.
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4909
    openFilenameStructureExternalAddress is an integer representing it's address"
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4910
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4911
    | rslt |
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4912
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4913
%{  /* STACK: 32000*/
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4914
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4915
    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
  4916
    int __rslt;
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4917
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4918
    if (__isExternalAddressLike(openFilenameStructureExternalAddress)
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4919
     || __isExternalBytesLike(openFilenameStructureExternalAddress)){ 
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4920
        __address = __externalAddressVal(openFilenameStructureExternalAddress);
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4921
        __rslt = __STX_API_CALL1( "GetSaveFileName", (void *)GetSaveFileName, __address);
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4922
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4923
        if (__rslt == TRUE) {
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4924
            rslt = true;
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4925
        } else {
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4926
            rslt = false;
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4927
        }
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4928
    }
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4929
%}.
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4930
    rslt isNil ifTrue:[ self primitiveFailed ].
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4931
    ^ rslt
15983
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4932
294a6922be11 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15923
diff changeset
  4933
    "Modified: / 11-02-2014 / 21:18:20 / cg"
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4934
! !
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
  4935
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4936
!Win32OperatingSystem class methodsFor:'file queries'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4937
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4938
caseSensitiveFilenames
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4939
    "return true, if the OS has caseSensitive file naming.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4940
     On MSDOS, this will return false;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4941
     on a real OS, we return true."
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
    ^ false
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
12969
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  4946
clearHidden:aPathName
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  4947
    "set the hidden attribute; Return true if the operation succeeded"
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  4948
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  4949
    |attr|
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  4950
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  4951
    attr := self primGetFileAttributes:aPathName.
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  4952
    (attr bitTest:FILE_ATTRIBUTE_HIDDEN ) ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4953
	^ self primSetFileAttributes:aPathName to:(attr bitClear:2).
12969
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  4954
    ].
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  4955
    ^ true
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  4956
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  4957
    "Created: / 29-07-2010 / 11:31:55 / sr"
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  4958
!
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  4959
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4960
compressPath:pathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4961
    "return the pathName compressed - that is, remove all ..-entries
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4962
     and . entries. This does not always (in case of symbolic links)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4963
     return the true pathName and is therefore used as a fallback
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4964
     if realPath and popen failed."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4965
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4966
    |names n "{ Class: SmallInteger }" |
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4967
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4968
    names := pathName
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4969
		asCollectionOfSubstringsSeparatedBy:self fileSeparator.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4970
    names := names asOrderedCollection.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4971
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4972
     cut off initial double-slashes
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4973
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4974
    [names startsWith:#('' '')] whileTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4975
	names removeFirst.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4976
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4977
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4978
     cut off double-slashes at end
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4979
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4980
    [names endsWith:#('')] whileTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4981
	names removeLast.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4982
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4983
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4984
     cut off current-dir at beginning
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4985
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4986
    n := names size.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4987
    [(n >= 2) and:[names startsWith:#('.')]] whileTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4988
	names removeFirst.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4989
	n := n - 1.
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4992
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4993
     cut off parent-dirs at end
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4994
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4995
    [(n > 2)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4996
     and:[(names endsWith:#('..'))
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4997
     and:[((names at:(n - 1)) startsWith:'.') not ]]] whileTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4998
	names removeLast; removeLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  4999
	n := n - 2.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5000
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5001
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5002
    ^ names asStringWith:self fileSeparator
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5003
		    from:1
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5004
		    to:n
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5005
		    compressTabs:false final:nil
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5006
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5007
    "
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5008
     OperatingSystem compressPath:'.\..'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5009
     OperatingSystem compressPath:'\foo\bar\baz\..'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5010
     OperatingSystem compressPath:'foo\bar\baz\..'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5011
     OperatingSystem compressPath:'foo\bar\baz\..\'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5012
     OperatingSystem compressPath:'foo\bar\baz\..\\\'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5013
     OperatingSystem compressPath:'\\\foo\bar\baz\..\\\'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5014
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5015
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5016
    "Modified: 1.11.1996 / 20:13:48 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5017
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5018
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5019
fileSeparator
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5020
    "return the character used to separate names in a path.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5021
     This character differs for MSDOS and other systems,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5022
     (but those are currently not supported - so this is some
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5023
      preparation for the future)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5024
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
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5027
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5028
getCurrentDirectory
14731
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5029
    "get the current directory"
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5030
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5031
    |dir|
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5032
%{
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5033
    int ret;
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5034
    wchar_t _aPathName[MAXPATHLEN+1];
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5035
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5036
    ret = GetCurrentDirectoryW(MAXPATHLEN, _aPathName);
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5037
    if (ret == 0) {
14740
609c0c77a4c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14731
diff changeset
  5038
	__threadErrno = __WIN32_ERR(GetLastError());
14731
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5039
    }
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5040
    dir = __MKU16STRING(_aPathName);
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5041
%}.
e287dc85f721 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14730
diff changeset
  5042
    ^ dir asSingleByteStringIfPossible
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5043
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5044
    "
11291
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5045
     self getCurrentDirectory
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5046
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5047
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5048
10014
6aba6d5620ad volumeName
Claus Gittinger <cg@exept.de>
parents: 9990
diff changeset
  5049
getDiskInfoOf:volumeNameArg
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5050
    "returns a dictionary filled with any of:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5051
	freeBytes
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5052
	totalBytes
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5053
     and possibly additional (OS-specific) information"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5054
10014
6aba6d5620ad volumeName
Claus Gittinger <cg@exept.de>
parents: 9990
diff changeset
  5055
    |volumeName info ok sectorsPerCluster bytesPerSector freeClusters totalClusters
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5056
     type freeBytesForUsersQuota freeBytes totalBytes |
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5057
10014
6aba6d5620ad volumeName
Claus Gittinger <cg@exept.de>
parents: 9990
diff changeset
  5058
    volumeName := volumeNameArg.
6aba6d5620ad volumeName
Claus Gittinger <cg@exept.de>
parents: 9990
diff changeset
  5059
    (volumeName endsWith:$\) ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5060
	volumeName := volumeName , '\'
10014
6aba6d5620ad volumeName
Claus Gittinger <cg@exept.de>
parents: 9990
diff changeset
  5061
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5062
%{
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  5063
    typedef BOOL (WINAPI *P_GDFSE)(LPCTSTR, PULARGE_INTEGER,
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5064
				   PULARGE_INTEGER, PULARGE_INTEGER);
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5065
    P_GDFSE pGetDiskFreeSpaceEx = NULL;
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5066
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5067
    DWORD __sectorsPerCluster, __bytesPerSector, __freeClusters, __totalClusters;
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5068
    BOOL  fResult = 0;
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5069
    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
  5070
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5071
    if (__isStringLike(volumeName) || __isSymbol(volumeName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5072
	 /*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5073
	  *  Use GetDiskFreeSpaceEx if available; otherwise, use GetDiskFreeSpace.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5074
	  *  Notice that GetDiskFreeSpace does not work correctly under win2k,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5075
	  *  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
  5076
	  */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5077
	pGetDiskFreeSpaceEx = (P_GDFSE)GetProcAddress (
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5078
					    GetModuleHandle ("kernel32.dll"),
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5079
							     "GetDiskFreeSpaceExA");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5080
	if (pGetDiskFreeSpaceEx) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5081
	    fResult = pGetDiskFreeSpaceEx (__stringVal(volumeName),
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5082
				 (PULARGE_INTEGER)&i64FreeBytesForUsersQuota,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5083
				 (PULARGE_INTEGER)&i64TotalBytes,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5084
				 (PULARGE_INTEGER)&i64FreeBytes);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5085
	    if (fResult) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5086
		freeBytesForUsersQuota = __MKUINT64(&i64FreeBytesForUsersQuota);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5087
		totalBytes = __MKUINT64(&i64TotalBytes);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5088
		freeBytes = __MKUINT64(&i64FreeBytes);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5089
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5090
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5091
	fResult = GetDiskFreeSpace(__stringVal(volumeName),
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5092
			     &__sectorsPerCluster,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5093
			     &__bytesPerSector,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5094
			     &__freeClusters,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5095
			     &__totalClusters);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5096
	if (fResult) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5097
	    sectorsPerCluster = __MKUINT(__sectorsPerCluster);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5098
	    bytesPerSector = __MKUINT(__bytesPerSector);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5099
	    freeClusters = __MKUINT(__freeClusters);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5100
	    totalClusters = __MKUINT(__totalClusters);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5101
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5102
	switch (GetDriveType(__stringVal(volumeName))) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5103
	    case DRIVE_REMOVABLE:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5104
		type = @symbol(removable); break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5105
	    case DRIVE_FIXED:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5106
		type = @symbol(fixed); break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5107
	    case DRIVE_REMOTE:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5108
		type = @symbol(network); break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5109
	    case DRIVE_CDROM:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5110
		type = @symbol(cdrom); break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5111
	    case DRIVE_RAMDISK:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5112
		type = @symbol(ramdisk); break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5113
	    case DRIVE_UNKNOWN:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5114
	    default:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5115
		break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5116
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5117
	if (fResult) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5118
	    ok = true;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5119
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5120
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5121
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5122
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5123
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5124
%}.
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5125
    ok == true ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5126
	self primitiveFailed.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5127
	^ self
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5128
    ].
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5129
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5130
    info := IdentityDictionary new.
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5131
    info at:#sectorsPerCluster put:sectorsPerCluster.
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5132
    info at:#bytesPerSector put:bytesPerSector.
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5133
    info at:#freeClusters put:freeClusters.
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5134
    info at:#totalClusters put:totalClusters.
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5135
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  5136
    info at:#freeBytes put:(freeBytes notNil
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5137
				ifTrue:[freeBytes]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5138
				ifFalse:[freeClusters * sectorsPerCluster * bytesPerSector]).
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5139
    info at:#totalBytes put:(totalBytes notNil
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5140
				ifTrue:[totalBytes]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5141
				ifFalse:[totalClusters * sectorsPerCluster * bytesPerSector]).
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5142
    info at:#freeBytesForUsersQuota put:freeBytesForUsersQuota.
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5143
    type notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5144
	info at:#type put:type
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5145
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5146
    ^ info
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5147
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5148
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5149
     self getDiskInfoOf:'c:\'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5150
     self getDiskInfoOf:'d:\'
9922
124793486a62 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9484
diff changeset
  5151
     self getDiskInfoOf:'e:\'
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  5152
     self getDiskInfoOf:'f:\'. OperatingSystem lastErrorString
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5153
    "
9955
98ff193dba8b fix getDiskInfoOf: for win2k
Claus Gittinger <cg@exept.de>
parents: 9924
diff changeset
  5154
10014
6aba6d5620ad volumeName
Claus Gittinger <cg@exept.de>
parents: 9990
diff changeset
  5155
    "Modified: / 26-09-2006 / 16:19:33 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5156
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5157
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5158
getDriveList
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5159
    "return a list of volumes in the system.
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5160
     On unix, no such thing like a volume exists
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5161
     - there, a syntetic list with root, home & current is returned.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5162
     On MSDOS, a list of drive letters is (eventually) returned.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5163
     On VMS, a list of volumes is (eventually) returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5164
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5165
    |list|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5166
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5167
    list := OrderedCollection new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5168
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5169
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5170
     * add drive letters as strings to list ...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5171
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5172
    char buffer[1024];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5173
    char *cp;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5174
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5175
    GetLogicalDriveStrings(1023, buffer);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5176
    for (cp=buffer; *cp; ) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5177
      __SSEND1(list, @symbol(add:), 0, __MKSTRING(cp));
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5178
      cp += strlen(cp) + 1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5179
    }
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
    ^ list
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5182
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5183
11247
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5184
getDriveType:aPathName
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5185
    "returns:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5186
	0 -> Unknown
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5187
	1 -> Invalid
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5188
	2 -> removable
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5189
	3 -> fixed
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5190
	4 -> remote
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5191
	5 -> cdrom
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5192
	6 -> ramdisk.
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5193
    This is a stupid interface - do not use."
11247
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5194
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5195
%{
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5196
    int ret;
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5197
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5198
    if (__isStringLike(aPathName)) {
11247
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5199
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5200
	char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5201
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5202
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5203
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5204
	    __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
  5205
	    // do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5206
	    ret = STX_API_NOINT_CALL1( "GetDriveType", GetDriveType, _aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5207
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5208
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5209
	ret = GetDriveType((char *) __stringVal(aPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5210
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5211
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5212
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5213
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5214
	RETURN (__MKSMALLINT(ret));
11247
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5215
    }
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5216
%}.
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5217
    ^ self primitiveFailed
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5218
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5219
    "
11291
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5220
     self getDriveType:'x:\'
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5221
     self getDriveType:'C:\'
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5222
     self getDriveType:'D:\'
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5223
    "
11247
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5224
!
f4206a7664bb *** empty log message ***
sr
parents: 11246
diff changeset
  5225
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5226
getFileVersionInfoOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5227
    "retrieves the versionData from an executable or dll.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5228
     The returned value is either a byteArray, which should be
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5229
     processed further with extractVersionValue (VerQueryValue),
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5230
     or nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5231
     This is a WIN32 specific entry, not for common usage."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5232
%{
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5233
    int sz;
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5234
    DWORD dummy;
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5235
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5236
    if (__isStringLike(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5237
	sz = GetFileVersionInfoSizeA(__stringVal(aPathName), &dummy);
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5238
    } else if (__isUnicode16String(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5239
	sz = GetFileVersionInfoSizeW(__unicode16StringVal(aPathName), &dummy);
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5240
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5241
	goto badArgument;
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5242
    }
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5243
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5244
    if (sz > 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5245
	OBJ versionData;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5246
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5247
	versionData = __BYTEARRAY_UNINITIALIZED_NEW_INT(sz);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5248
	if (versionData == nil) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5249
	    RETURN (nil);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5250
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5251
	if (GetFileVersionInfo(__stringVal(aPathName), 0, sz, __ByteArrayInstPtr(versionData)->ba_element) == FALSE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5252
	    RETURN (nil);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5253
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5254
	RETURN (versionData);
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5255
    }
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5256
    RETURN (nil);
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5257
badArgument: ;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5258
%}.
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5259
    self primitiveFailed
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5260
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5261
    "Modified: / 05-07-2006 / 16:56:06 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5262
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5263
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5264
getLongPathName:aPathName
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5265
    "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
  5266
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5267
%{
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5268
    int ret;
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  5269
    wchar_t _aPathName[MAXPATHLEN+1];
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5270
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5271
    if (__isStringLike(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5272
	int i;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5273
	INT l = __stringSize(aPathName);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5274
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  5275
	if (l > MAXPATHLEN) l = MAXPATHLEN;
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5276
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5277
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5278
	    _aPathName[i] = __stringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5279
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5280
	_aPathName[i] = 0;
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5281
    } else if (__isUnicode16String(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5282
	int i;
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5283
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  5284
	INT l = __unicode16StringSize(aPathName);
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  5285
	if (l > MAXPATHLEN) l = MAXPATHLEN;
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5286
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5287
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5288
	    _aPathName[i] = __unicode16StringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5289
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5290
	_aPathName[i] = 0;
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5291
    } else
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5292
	goto badArgument;
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5293
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5294
#ifdef DO_WRAP_CALLS
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5295
     do {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5296
	 __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
  5297
	 // do not cast to INT - will loose sign bit then!
13780
2f055d86569e visual c compilability
Claus Gittinger <cg@exept.de>
parents: 13778
diff changeset
  5298
	 ret = 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
  5299
     } while ((ret == 0) && (__threadErrno == EINTR));
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5300
#else
13780
2f055d86569e visual c compilability
Claus Gittinger <cg@exept.de>
parents: 13778
diff changeset
  5301
     ret = GetLongPathNameW(_aPathName, _aPathName, MAXPATHLEN);
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5302
     if (ret == 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5303
	 __threadErrno = __WIN32_ERR(GetLastError());
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5304
     }
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5305
#endif
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5306
     RETURN ( __MKU16STRING(_aPathName));
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5307
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5308
badArgument:;
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5309
%}.
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5310
    ^ self primitiveFailed
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5311
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5312
    "
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5313
     self getLongPathName:'x:\'
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  5314
     self getLongPathName:'c:\Dokumente und Einstellungen'
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  5315
     self getShortPathName:'c:\Dokumente und Einstellungen'
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5316
    "
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5317
!
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5318
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5319
getNullDevice
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5320
    "get the name of the null-device."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5321
8755
8e67c864b126 Fix #getNullDevice
Stefan Vogel <sv@exept.de>
parents: 8742
diff changeset
  5322
    ^ 'nul:'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5323
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5324
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5325
getShortPathName:aPathName
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5326
    "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
  5327
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5328
%{
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5329
    int ret;
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  5330
    wchar_t _aPathName[MAXPATHLEN+1];
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5331
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5332
    if (__isStringLike(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5333
	int i;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5334
	int l = __stringSize(aPathName);
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  5335
	if (l > MAXPATHLEN) l = MAXPATHLEN;
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5336
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5337
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5338
	    _aPathName[i] = __stringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5339
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5340
	_aPathName[i] = 0;
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5341
    } else if (__isUnicode16String(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5342
	int i;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5343
	int l = __unicode16StringSize(aPathName);
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  5344
	if (l > MAXPATHLEN) l = MAXPATHLEN;
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5345
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5346
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5347
	    _aPathName[i] = __unicode16StringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5348
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5349
	_aPathName[i] = 0;
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5350
    } else
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5351
	goto badArgument;
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5352
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5353
#ifdef DO_WRAP_CALLS
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5354
     do {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5355
	 __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
  5356
	 // do not cast to INT - will loose sign bit then!
13780
2f055d86569e visual c compilability
Claus Gittinger <cg@exept.de>
parents: 13778
diff changeset
  5357
	 ret = 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
  5358
     } while ((ret == 0) && (__threadErrno == EINTR));
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5359
#else
13780
2f055d86569e visual c compilability
Claus Gittinger <cg@exept.de>
parents: 13778
diff changeset
  5360
     ret = GetShortPathNameW(_aPathName, _aPathName, MAXPATHLEN);
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5361
     if (ret == 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5362
	 __threadErrno = __WIN32_ERR(GetLastError());
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5363
     }
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5364
#endif
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5365
     RETURN ( __MKU16STRING(_aPathName));
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5366
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5367
badArgument:;
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5368
%}.
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5369
    ^ self primitiveFailed
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5370
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5371
    "
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5372
     self getShortPathName:'x:\'
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  5373
     self getShortPathName:'c:\Dokumente und Einstellungen'
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  5374
     self getLongPathName:'c:\Dokumente und Einstellungen'
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5375
    "
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5376
!
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5377
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5378
getVolumeInformation: rootPath
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5379
    name: volumeNameBuffer
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5380
    nameSize: volumeNameSize
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5381
    serialNumber: serialNumber
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5382
    maximumComponentLength: maximumComponentLength
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5383
    fileSystemFlags: fileSystemFlags
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5384
    fileSystemName: fileSystemName
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5385
    fileSystemNameSize: fileSystemNameSize
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5386
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5387
    <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
  5388
    ^self primitiveFailed
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5389
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  5390
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5391
infoOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5392
    "return some object filled with info for the file 'aPathName';
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5393
     the info (for which corresponding access methods are understood by
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5394
     the returned object) is:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5395
	 type            - a symbol giving the files type
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5396
	 mode            - numeric access mode
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5397
	 uid             - owners user id
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5398
	 gid             - owners group id
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5399
	 size            - files size
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5400
	 id              - files number (i.e. inode number)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5401
	 accessed        - last access time (as Timestamp)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5402
	 modified        - last modification time (as Timestamp)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5403
	 statusChanged   - last status change time (as Timestamp)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5404
	 alternativeName - (windows only:) the MSDOS name of the file
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5405
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5406
     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
  5407
     all of the information.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5408
     Return nil if such a file does not exist.
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5409
     For symbolic links (if supported by the OS),
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5410
     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
  5411
     use #linkInfoOf: to get info about the link itself.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5412
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5413
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5414
    |info target|
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5415
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5416
    info := self linkInfoOf:aPathName.
10164
2a98bef917b7 care for nil linkInfo
ca
parents: 10161
diff changeset
  5417
    (info notNil and:[info isSymbolicLink]) ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5418
	target := info path.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5419
	target notNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5420
	    ^ self linkInfoOf:target.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5421
	]
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5422
    ].
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5423
    ^ info
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5424
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5425
   "
6377
0113dcb902c5 simulate :drive as a directory
Claus Gittinger <cg@exept.de>
parents: 6372
diff changeset
  5426
    OperatingSystem infoOf:'c:\windows'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5427
    OperatingSystem infoOf:'stx.exe'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5428
    (OperatingSystem infoOf:'/') uid
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5429
    (OperatingSystem infoOf:'/') accessed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5430
   "
6377
0113dcb902c5 simulate :drive as a directory
Claus Gittinger <cg@exept.de>
parents: 6372
diff changeset
  5431
10373
92efacf8b050 getLinkTarget is now done lazyly.
Claus Gittinger <cg@exept.de>
parents: 10365
diff changeset
  5432
    "Modified: / 07-02-2007 / 10:37:14 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5433
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5434
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5435
isDirectory:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5436
    "return true, if 'aPathName' is a valid directory path name.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5437
     (i.e. exists and is a directory).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5438
     This also returns true for symbolic links pointing to a directory;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5439
     if you need to check for this, use #linkInfo:."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5440
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5441
%{
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5442
    int ret;
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5443
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5444
    if (__isStringLike(aPathName)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5445
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5446
	char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5447
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5448
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5449
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5450
	    __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
  5451
	    // do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5452
	    ret = STX_API_NOINT_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5453
	} while ((ret == -1) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5454
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5455
	ret = GetFileAttributesA((char *) __stringVal(aPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5456
	if (ret == -1) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5457
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5458
	}
12715
1ef13bfe9cbb changed:15 methods
sr
parents: 12686
diff changeset
  5459
#endif
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5460
    } else if (__isUnicode16String(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5461
	wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5462
	int i, l;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5463
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5464
	l = __unicode16StringSize(aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5465
	if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5466
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5467
	    _wPathName[i] = __unicode16StringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5468
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5469
	_wPathName[i] = 0;
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5470
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5471
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5472
	    __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
  5473
	    // do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5474
	    ret = STX_API_NOINT_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5475
	} while ((ret == -1) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5476
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5477
	ret = GetFileAttributesW(_wPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5478
	if (ret == -1) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5479
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5480
	}
12715
1ef13bfe9cbb changed:15 methods
sr
parents: 12686
diff changeset
  5481
#endif
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5482
    } else
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5483
	goto err;
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5484
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5485
    if (ret < 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5486
	@global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5487
	RETURN ( false );
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5488
    }
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5489
    RETURN ( (ret & FILE_ATTRIBUTE_DIRECTORY) ? true : false);
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5490
err:;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5491
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5492
    ^ self primitiveFailed
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
    "an alternative implementation would be:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5495
	^ (self infoOf:aPathName) type == #directory
11291
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5496
    "
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5497
    "
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5498
     self isDirectory:'.'
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5499
     self isDirectory:'.' asUnicode16String
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5500
    "
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5501
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5502
    "Modified: / 05-07-2006 / 17:23:42 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5503
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5504
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5505
isExecutable:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5506
    "return true, if the given file is executable.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5507
     For symbolic links, the pointed-to-file is checked."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5508
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5509
    "/
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5510
    "/ under windows, there is no executable attribute ...
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5511
    "/ so, only check for the files existence here.
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5512
    "/
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5513
    ^ self isValidPath:aPathName.
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5514
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5515
    "Modified: / 05-07-2006 / 17:23:19 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5516
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5517
10596
072effcc1e88 added #isHidden
sr
parents: 10585
diff changeset
  5518
isHidden:aPathName
072effcc1e88 added #isHidden
sr
parents: 10585
diff changeset
  5519
    "return true, if the given file is hidden"
072effcc1e88 added #isHidden
sr
parents: 10585
diff changeset
  5520
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5521
    |attr|
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5522
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5523
    attr := self primGetFileAttributes:aPathName.
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5524
    attr notNil ifTrue:[^ attr bitTest: FILE_ATTRIBUTE_HIDDEN ].
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5525
    ^ false
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5526
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5527
    "
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5528
     self isHidden:'.'
11291
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5529
     self isHidden:'.' asUnicode16String
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5530
    "
10596
072effcc1e88 added #isHidden
sr
parents: 10585
diff changeset
  5531
!
072effcc1e88 added #isHidden
sr
parents: 10585
diff changeset
  5532
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5533
isReadable:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5534
    "return true, if the file/dir 'aPathName' is readable.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5535
     For symbolic links, the pointed-to-file is checked."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5536
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5537
%{
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5538
    if (__isStringLike(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5539
	int ret;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5540
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5541
	/*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5542
	 * under windows, all files are readable ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5543
	 * so, only check for the files existence here.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5544
	 */
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
  5545
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5546
	char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5547
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5548
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5549
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5550
	    __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
  5551
	    // do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5552
	    ret = STX_API_NOINT_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5553
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5554
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5555
	ret = GetFileAttributesA((char *) __stringVal(aPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5556
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5557
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5558
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5559
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5560
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5561
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5562
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5563
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5564
	RETURN (true);
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5565
    }
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5566
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5567
    if (__isUnicode16String(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5568
	int ret;
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
	/*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5571
	 * under windows, all files are readable ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5572
	 * so, only check for the files existence here.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5573
	 */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5574
	wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5575
	int i, l;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5576
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5577
	l = __unicode16StringSize(aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5578
	if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5579
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5580
	    _wPathName[i] = __unicode16StringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5581
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5582
	_wPathName[i] = 0;
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5583
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5584
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5585
	    __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
  5586
	    // do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5587
	    ret = STX_API_NOINT_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5588
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5589
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5590
	ret = GetFileAttributesW(_wPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5591
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5592
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5593
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5594
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5595
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5596
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5597
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5598
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5599
	RETURN (true);
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5600
    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5601
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5602
    ^ self primitiveFailed
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5603
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5604
    "
11291
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5605
     self isReadable:'.'
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5606
     self isReadable:'.' asUnicode16String
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5607
    "
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5608
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5609
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5610
isTemporary:aPathName
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5611
    "return true, if the given file is a temporary file"
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5612
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5613
    |attr|
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5614
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5615
    attr := self primGetFileAttributes:aPathName.
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5616
    attr notNil ifTrue:[^ attr bitTest: FILE_ATTRIBUTE_TEMPORARY ].
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5617
    ^ false
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5618
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5619
    "
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5620
     self isTemporary:'.'
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5621
     self isTemporary:'.' asUnicode16String
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5622
    "
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5623
!
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5624
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5625
isValidPath:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5626
    "return true, if 'aPathName' is a valid path name
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5627
     (i.e. the file or directory exists)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5628
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5629
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5630
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5631
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5632
    if (__isStringLike(aPathName)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5633
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5634
	char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5635
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5636
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5637
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5638
	    __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
  5639
	    // do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5640
	    ret = STX_API_NOINT_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5641
	} while ((ret == -1) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5642
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5643
	ret = GetFileAttributesA((char *) __stringVal(aPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5644
	if (ret == -1) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5645
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5646
	}
12715
1ef13bfe9cbb changed:15 methods
sr
parents: 12686
diff changeset
  5647
#endif
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5648
    } else  if (__isUnicode16String(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5649
	wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5650
	int i, l;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5651
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5652
	l = __unicode16StringSize(aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5653
	if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5654
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5655
	    _wPathName[i] = __unicode16StringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5656
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5657
	_wPathName[i] = 0;
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5658
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5659
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5660
	    __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
  5661
	    // do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5662
	    ret = STX_API_NOINT_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5663
	} while ((ret == -1) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5664
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5665
	ret = GetFileAttributesW(_wPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5666
	if (ret == -1) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5667
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5668
	}
12715
1ef13bfe9cbb changed:15 methods
sr
parents: 12686
diff changeset
  5669
#endif
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5670
    } else
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5671
	goto err;
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5672
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5673
    if (ret == -1) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5674
	@global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5675
	RETURN ( false );
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5676
    }
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5677
    RETURN (true);
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5678
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  5679
err:;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5680
%}.
15039
aad511684e79 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14889
diff changeset
  5681
    aPathName isString ifTrue:[
aad511684e79 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14889
diff changeset
  5682
	aPathName isUnicode32String ifTrue:[
aad511684e79 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14889
diff changeset
  5683
	    "/ WIN32 only support 16 bit (wide) strings
aad511684e79 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14889
diff changeset
  5684
	    ^ self isValidPath:aPathName asUnicode16String
aad511684e79 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14889
diff changeset
  5685
	]
aad511684e79 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14889
diff changeset
  5686
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5687
    ^ self primitiveFailed
9424
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5688
a90e99c554d4 preps for wchar filenames
Claus Gittinger <cg@exept.de>
parents: 9390
diff changeset
  5689
    "Modified: / 05-07-2006 / 17:23:51 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5690
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5691
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5692
isWritable:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5693
    "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
  5694
     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
  5695
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5696
     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
  5697
     See http://support.microsoft.com/kb/326549.
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5698
     So we always return true for directories."
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5699
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5700
    |attr|
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5701
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5702
    attr := self primGetFileAttributes:aPathName.
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5703
    attr notNil ifTrue:[
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  5704
	^ (attr bitAnd: (FILE_ATTRIBUTE_DIRECTORY bitOr: FILE_ATTRIBUTE_READONLY ))
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  5705
	    ~~ FILE_ATTRIBUTE_READONLY
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5706
    ].
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5707
    ^ false
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5708
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5709
    "
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5710
     self isWritable:'.'
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5711
     self isWritable:'.' asUnicode16String
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5712
     self isWritable:'' asUnicode16String
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5713
    "
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5714
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5715
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5716
linkInfoOf:aPathName
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5717
    "return some object filled with info for the file 'aPathName';
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5718
     the info (for which corresponding access methods are understood by
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5719
     the returned object) is:
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5720
	 type            - a symbol giving the files type
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5721
	 mode            - numeric access mode
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5722
	 uid             - owners user id
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5723
	 gid             - owners group id
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5724
	 size            - files size
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5725
	 id              - files number (i.e. inode number)
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5726
	 accessed        - last access time (as Timestamp)
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5727
	 modified        - last modification time (as Timestamp)
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5728
	 statusChanged   - last status change time (as Timestamp)
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5729
	 alternativeName - (windows only:) the MSDOS name of the file
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5730
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5731
     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
  5732
     all of the information.
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5733
     Return nil if such a file does not exist.
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  5734
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  5735
     Return the info about the link itself,
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  5736
     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
  5737
     in case of a symbolic link.
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5738
    "
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5739
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5740
    |info type mode uid gid size id
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5741
     atime mtime ctime
12821
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
  5742
     aOsTime mOsTime cOsTime
11258
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
  5743
     fileName alternativeName|
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5744
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5745
%{
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5746
    BOOL result;
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5747
    int ret;
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5748
    wchar_t alternativeFileNameBuffer[15];
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  5749
    wchar_t fileNameBuffer[MAXPATHLEN+1];
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5750
    int modeBits = 0;
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5751
    WIN32_FILE_ATTRIBUTE_DATA fileAttributeData;
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5752
    unsigned INT ino;
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  5753
    wchar_t _aPathName[MAXPATHLEN+1];
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5754
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5755
    if (__isStringLike(aPathName)) {
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5756
	int i;
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5757
	int l = __stringSize(aPathName);
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5758
	if (l > MAXPATHLEN) l = MAXPATHLEN;
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5759
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5760
	for (i=0; i<l; i++) {
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5761
	    _aPathName[i] = __stringVal(aPathName)[i];
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5762
	}
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5763
	_aPathName[i] = 0;
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5764
    } else if (__isUnicode16String(aPathName)) {
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5765
	int i;
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5766
	int l = __unicode16StringSize(aPathName);
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5767
	if (l > MAXPATHLEN) l = MAXPATHLEN;
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5768
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5769
	for (i=0; i<l; i++) {
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5770
	    _aPathName[i] = __unicode16StringVal(aPathName)[i];
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5771
	}
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5772
	_aPathName[i] = 0;
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5773
    } else
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5774
	goto badArgument;
11291
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  5775
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5776
#ifdef DO_WRAP_CALLS
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5777
    {
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5778
	do {
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5779
	    __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
  5780
	    // do not cast to INT - will loose sign bit then!
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5781
	    result = STX_API_NOINT_CALL3( "GetFileAttributesExW", GetFileAttributesExW, _aPathName, GetFileExInfoStandard, &fileAttributeData);
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5782
	} while (!result && (__threadErrno == EINTR));
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5783
    }
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5784
#else
11811
530bb21f57f9 #linkInfoOf:
Stefan Vogel <sv@exept.de>
parents: 11810
diff changeset
  5785
    result = GetFileAttributesExW(_aPathName, GetFileExInfoStandard, &fileAttributeData);
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5786
    if (!result) {
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5787
	__threadErrno = __WIN32_ERR(GetLastError());
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5788
    }
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5789
#endif
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5790
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5791
    if (!result) {
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5792
	@global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5793
    } else {
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5794
	id = __mkSmallInteger(0);   /* could get it by opening ... */
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5795
	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
  5796
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5797
//        if (fileAttributeData.cFileName[0] != '\0') {
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  5798
//            bcopy(fileAttributeData.cFileName, fileNameBuffer, MAXPATHLEN*sizeof(wchar_t));
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  5799
//            fileNameBuffer[MAXPATHLEN] = '\0';
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5800
//            fileName = __MKU16STRING(fileNameBuffer);             /* FULL name */
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5801
//        }
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5802
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5803
//        if (fileAttributeData.cAlternateFileName[0] != '\0') {
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5804
//            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
  5805
//            alternativeFileNameBuffer[14] = '\0';
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5806
//            alternativeName = __MKU16STRING(alternativeFileNameBuffer); /* DOS name */
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
  5807
//        }
11779
73c3f28d8960 Fix write access checking fpr directories in Windows.
Stefan Vogel <sv@exept.de>
parents: 11767
diff changeset
  5808
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5809
	/*
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5810
	 * simulate access bits
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5811
	 */
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5812
	if (fileAttributeData.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5813
	    modeBits = 0444;
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5814
	} else {
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5815
	    modeBits = 0666;
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5816
	}
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5817
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5818
	if (fileAttributeData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5819
	    type = @symbol(directory);
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5820
	    modeBits = 0777;   /* executable and WRITABLE - refer to comment in #isWritable: */
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5821
	} else if (fileAttributeData.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5822
	    type = @symbol(symbolicLink);
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5823
	    modeBits = 0777;   /* even in UNIX symlinks have 0777 */
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5824
	} else {
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5825
	    type = @symbol(regular);
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5826
	}
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5827
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5828
	mode = __mkSmallInteger(modeBits);
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5829
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5830
	cOsTime = FileTimeToOsTime(&fileAttributeData.ftCreationTime);
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5831
	aOsTime = FileTimeToOsTime(&fileAttributeData.ftLastAccessTime);
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5832
	mOsTime = FileTimeToOsTime(&fileAttributeData.ftLastWriteTime);
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5833
    }
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5834
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  5835
  badArgument: ;
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5836
%}.
11811
530bb21f57f9 #linkInfoOf:
Stefan Vogel <sv@exept.de>
parents: 11810
diff changeset
  5837
10161
fd6b02ffb383 avoid recursion
Claus Gittinger <cg@exept.de>
parents: 10160
diff changeset
  5838
    (aPathName endsWith:'.lnk') ifTrue:[
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5839
	type := #symbolicLink.
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5840
	"/ now done lazyly in FileStatusInfo, when the path is accessed
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5841
	"/ path := self getLinkTarget:aPathName.
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5842
    ].
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5843
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5844
    mode isNil ifTrue:[
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5845
	(self isDirectory:aPathName) ifTrue:[
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5846
	    "/ the code above fails for root directories (these do not exist).
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5847
	    "/ simulate here
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5848
	    mode := 8r777.
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5849
	    type := #directory.
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5850
	    uid := gid := 0.
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5851
	    size := 0.
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5852
	    id := 0.
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5853
	    atime := mtime := ctime := Timestamp now.
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5854
	].
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5855
    ].
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5856
    mode notNil ifTrue:[
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5857
	atime isNil ifTrue:[
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5858
	    atime := Timestamp new fromOSTime:aOsTime.
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5859
	].
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5860
	mtime isNil ifTrue:[
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5861
	    mtime := Timestamp new fromOSTime:mOsTime.
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5862
	].
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5863
	ctime isNil ifTrue:[
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5864
	    ctime := Timestamp new fromOSTime:cOsTime.
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5865
	].
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5866
	fileName notNil ifTrue:[
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5867
	    fileName := fileName asSingleByteStringIfPossible
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5868
	].
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5869
	alternativeName notNil ifTrue:[
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5870
	    alternativeName := alternativeName asSingleByteStringIfPossible
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5871
	].
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5872
	info := FileStatusInfo
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5873
		    type:type
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5874
		    mode:mode
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5875
		    uid:uid
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5876
		    gid:gid
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5877
		    size:size
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5878
		    id:id
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5879
		    accessed:atime
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5880
		    modified:mtime
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5881
		    created:ctime
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5882
		    sourcePath:aPathName
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5883
		    fullName:fileName
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5884
		    alternativeName:alternativeName.
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  5885
	^ info
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5886
   ].
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5887
   ^ nil
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5888
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5889
   "
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5890
    OperatingSystem linkInfoOf:'c:\windows'
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  5891
    OperatingSystem linkInfoOf:'stx.exe'
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  5892
    (OperatingSystem linkInfoOf:'/') uid
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  5893
    (OperatingSystem linkInfoOf:'/') accessed
11811
530bb21f57f9 #linkInfoOf:
Stefan Vogel <sv@exept.de>
parents: 11810
diff changeset
  5894
    OperatingSystem linkInfoOf:'C:\Dokumente und Einstellungen\stefan\Desktop\System.lnk'
10158
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5895
   "
8382920f9265 symbolic link targets
Claus Gittinger <cg@exept.de>
parents: 10098
diff changeset
  5896
10373
92efacf8b050 getLinkTarget is now done lazyly.
Claus Gittinger <cg@exept.de>
parents: 10365
diff changeset
  5897
    "Modified: / 07-02-2007 / 10:30:14 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5898
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5899
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5900
mimeTypeForSuffix:aFileSuffix
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5901
    "given a file suffix, return a corresponding mimeType.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5902
     Here, the Registry is consulted.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5903
     Returns nil if no mimeType for the given suffix is known."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5904
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5905
    ^ RegistryEntry
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5906
	stringValueFor:'Content Type'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5907
	atKey:('HKEY_CLASSES_ROOT\.' , aFileSuffix)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5908
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5909
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5910
     self mimeTypeForSuffix:'au'
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  5911
     self mimeTypeForSuffix:'st'
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  5912
     self mimeTypeForSuffix:'dll'
9013
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  5913
    "
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5914
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5915
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5916
parentDirectoryName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5917
    "return the name used to refer to parent directories.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5918
     In MSDOS, Unix and other systems this is '..', but maybe different
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5919
     for other systems.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5920
     (but those are currently not supported - so this is some
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5921
      preparation for the future)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5922
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5923
    ^ '..'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5924
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5925
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5926
pathNameOf:pathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5927
    "return the pathName of the argument, aPathString,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5928
     - thats the full pathname of the directory, starting at '/'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5929
     This method needs the path to be valid
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5930
     (i.e. all directories must exist, be readable and executable).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5931
     Notice: if symbolic links are involved, the result may look different
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5932
     from what you expect."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5933
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5934
    |p path|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5935
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5936
    "some systems have a convenient function for this ..."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5937
    path := self primPathNameOf:pathName.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5938
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5939
    path isNil ifTrue:[
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  5940
	(self isValidPath:pathName) ifFalse:[
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  5941
	    p := pathName.
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  5942
	    [(p size > 1)
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  5943
	     and:[p endsWith:(self fileSeparator)]
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  5944
	    ] whileTrue:[
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  5945
		p := p copyButLast:1.
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  5946
	    ].
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  5947
	    ^ p
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  5948
	].
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  5949
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  5950
	"/
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  5951
	"/ return the original - there is nothing else can we do
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  5952
	"/
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  5953
	path := self compressPath:pathName
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5954
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5955
    ^ path.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5956
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5957
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5958
     OperatingSystem pathNameOf:'.'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5959
     OperatingSystem pathNameOf:'../smalltalk/../smalltalk'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5960
     OperatingSystem pathNameOf:'../../..'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5961
     OperatingSystem pathNameOf:'..'
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5962
     OperatingSystem pathNameOf:'/tmp////'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5963
     OperatingSystem pathNameOf:'/foo/bar'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5964
     OperatingSystem pathNameOf:'/foo/bar/'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5965
     OperatingSystem pathNameOf:'/foo/bar//'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5966
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5967
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5968
    "Modified: 29.11.1996 / 18:02:12 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5969
    "Modified: 10.1.1997 / 19:10:42 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5970
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5971
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5972
primGetFileAttributes:aPathName
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5973
    "get the file-attributes"
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5974
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5975
    |errorNumber|
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5976
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5977
%{
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5978
    int ret;
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5979
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  5980
    if (__isStringLike(aPathName)) {
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  5981
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5982
	char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5983
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5984
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5985
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5986
	    __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
  5987
	    // do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5988
	    ret = STX_API_NOINT_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5989
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5990
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5991
	ret = GetFileAttributesA((char *) __stringVal(aPathName));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5992
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5993
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5994
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5995
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5996
	if (ret >= 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5997
	    RETURN ( __mkSmallInteger(ret) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5998
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  5999
	__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6000
	RETURN (nil);
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6001
    }
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6002
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6003
    if (__isUnicode16String(aPathName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6004
	wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6005
	int i, l;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6006
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6007
	l = __unicode16StringSize(aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6008
	if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6009
	for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6010
	    _wPathName[i] = __unicode16StringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6011
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6012
	_wPathName[i] = 0;
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6013
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6014
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6015
	    __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
  6016
	    // do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6017
	    ret = STX_API_NOINT_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6018
	} while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6019
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6020
	ret = GetFileAttributesW(_wPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6021
	if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6022
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6023
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6024
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6025
	if (ret >= 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6026
	    RETURN ( __mkSmallInteger(ret) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6027
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6028
	__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6029
	RETURN (nil);
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6030
    }
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6031
%}.
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6032
    ^ self primitiveFailed
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6033
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
     self primGetFileAttributes:'.'
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6036
     self primGetFileAttributes:'bc.mak'
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6037
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6038
     self primGetFileAttributes:'.' asUnicodeString
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  6039
     self primGetFileAttributes:'bc.mak' asUnicodeString
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6040
    "
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
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6043
primIdOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6044
    "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
  6045
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6046
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6047
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6048
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6049
primPathNameOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6050
    "return the pathName of the argument, aPathString,
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6051
     - thats the full pathname of the directory, starting at 'X:\'.
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6052
     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
  6053
     Notice: if symbolic links are involved, the result may look different
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6054
     from what you expect."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6055
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6056
    |error|
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6057
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6058
%{
9390
a0c059f2477c #primPathNameOf: -- allow symbol as arg (sv)
ca
parents: 9384
diff changeset
  6059
    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
  6060
	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
  6061
	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
  6062
	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
  6063
	int rslt;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6064
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6065
#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
  6066
	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
  6067
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6068
	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
  6069
	do {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6070
	    __threadErrno = 0;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6071
	    // 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
  6072
	    rslt = STX_API_NOINT_CALL4( "GetFullPathNameA", GetFullPathNameA, _aPathName, MAXPATHLEN, nameBuffer, NULL);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6073
	} 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
  6074
#else
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6075
	rslt = GetFullPathNameA(__stringVal(aPathName), MAXPATHLEN, nameBuffer, NULL);
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6076
#endif
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6077
	returnedName = nameBuffer;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6078
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6079
	if (rslt > 0) {
8652
793cc6e353bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8651
diff changeset
  6080
#ifdef DO_WRAP_CALLS
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6081
	    do {
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6082
		__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
  6083
		// do not cast to INT - will loose sign bit then!
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6084
		rslt = STX_API_NOINT_CALL3( "GetLongPathNameA", GetLongPathNameA, nameBuffer, nameBuffer2, MAXPATHLEN);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6085
	    } while ((rslt < 0) && (__threadErrno == EINTR));
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6086
#else
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6087
	    rslt = GetLongPathNameA(nameBuffer, nameBuffer2, MAXPATHLEN);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6088
#endif
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6089
	    returnedName = nameBuffer2;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6090
	}
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6091
	if (rslt > 0) {
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6092
	    RETURN ( __MKSTRING(returnedName) );
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6093
	}
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6094
	__threadErrno = __WIN32_ERR(GetLastError());
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6095
	RETURN (nil);
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6096
    }
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6097
    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
  6098
	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
  6099
	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
  6100
	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
  6101
	int rslt;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6102
	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
  6103
	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
  6104
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6105
	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
  6106
	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
  6107
	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
  6108
	    _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
  6109
	}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6110
	_aPathName[i] = 0;
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6111
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6112
#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
  6113
	do {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6114
	    __threadErrno = 0;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6115
	    rslt = (INT)STX_API_NOINT_CALL4( "GetFullPathNameW", GetFullPathNameW, _aPathName, MAXPATHLEN, nameBuffer, NULL);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6116
	} 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
  6117
#else
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6118
	rslt = GetFullPathNameW(_aPathName, MAXPATHLEN, nameBuffer, NULL);
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  6119
#endif
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  6120
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6121
	returnedName = nameBuffer;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6122
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6123
	if (rslt > 0) {
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  6124
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6125
#ifdef DO_WRAP_CALLS
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6126
	    do {
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6127
		__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
  6128
		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
  6129
	    } while ((rslt < 0) && (__threadErrno == EINTR));
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6130
#else
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6131
	    rslt = GetLongPathNameW(nameBuffer, nameBuffer2, MAXPATHLEN);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6132
#endif
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6133
	    returnedName = nameBuffer2;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6134
	}
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6135
	if (rslt > 0) {
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6136
	    RETURN ( __MKU16STRING(returnedName) );
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6137
	}
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6138
	__threadErrno = __WIN32_ERR(GetLastError());
15377
3ea5dc7aae24 ouch: primPathName with an Unicode argument reported primFail
Claus Gittinger <cg@exept.de>
parents: 15369
diff changeset
  6139
	RETURN (nil);
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6140
    }
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6141
    error = @symbol(argument);     // argument is not a string or unicode16string
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6142
%}.
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  6143
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6144
    error notNil ifTrue:[
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  6145
	self primitiveFailed:error.
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6146
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6147
    ^ nil
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6148
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6149
    "
11291
1e7c06d9d939 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11289
diff changeset
  6150
     self primPathNameOf:'.'
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6151
     self primPathNameOf:'.' asUnicode16String
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  6152
     self primPathNameOf:5555
11289
11c2bb7debc4 unicode filenames
Claus Gittinger <cg@exept.de>
parents: 11258
diff changeset
  6153
    "
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6154
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6155
12616
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6156
primSetCurrentDirectoryA:pathName
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6157
    <apicall: bool "SetCurrentDirectoryA" ( pointer ) module: "kernel32.dll" >
12616
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6158
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6159
    self primitiveFailed.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6160
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6161
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6162
     self primSetCurrentDirectory:'C:\Dokumente und Einstellungen\User\Eigene Dateien\work5\stx\projects\smalltalk'.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6163
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6164
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6165
    "Created: / 27-07-2006 / 14:47:12 / fm"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6166
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6167
12616
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6168
primSetCurrentDirectoryW:pathName
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6169
    <apicall: bool "SetCurrentDirectoryW" ( pointer ) module: "kernel32.dll" >
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6170
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6171
    self primitiveFailed.
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6172
!
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6173
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6174
primSetFileAttributes:aPathName to:anInteger
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6175
    "set the file-attributes; return true if the set did happen"
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6176
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6177
    |errorNumber|
10622
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6178
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6179
%{
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6180
    int ret;
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6181
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  6182
    if (__isSmallInteger(anInteger)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6183
	if (__isStringLike(aPathName)) {
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6184
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6185
	    char _aPathName[MAXPATHLEN];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6186
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6187
	    strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6188
	    do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6189
		__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
  6190
		// do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6191
		ret = STX_API_NOINT_CALL2( "SetFileAttributesA", SetFileAttributesA, _aPathName, __intVal(anInteger) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6192
	    } while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6193
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6194
	    ret = SetFileAttributesA((char *) __stringVal(aPathName), __intVal(anInteger));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6195
	    if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6196
		__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6197
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6198
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6199
	    if (ret >= 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6200
		RETURN ( true );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6201
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6202
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6203
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6204
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6205
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6206
	if (__isUnicode16String(aPathName)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6207
	    wchar_t _wPathName[MAXPATHLEN+1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6208
	    int i, l;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6209
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6210
	    l = __unicode16StringSize(aPathName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6211
	    if (l > MAXPATHLEN) l = MAXPATHLEN;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6212
	    for (i=0; i<l; i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6213
		_wPathName[i] = __unicode16StringVal(aPathName)[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6214
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6215
	    _wPathName[i] = 0;
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6216
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6217
	    do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6218
		__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
  6219
		// do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6220
		ret = STX_API_NOINT_CALL2( "SetFileAttributesW", SetFileAttributesW, _wPathName, __intVal(anInteger) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6221
	    } while ((ret < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6222
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6223
	    ret = SetFileAttributesW(_wPathName, __intVal(anInteger));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6224
	    if (ret < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6225
		__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6226
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6227
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6228
	    if (ret >= 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6229
		RETURN ( true );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6230
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6231
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6232
	    RETURN (false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6233
	}
10622
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6234
    }
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6235
%}.
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6236
    ^ self primitiveFailed
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6237
!
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6238
12616
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6239
setCurrentDirectory:pathName
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6240
    pathName bitsPerCharacter == 16 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6241
	self primSetCurrentDirectoryW:(pathName copyWith:(Character value:0))
12616
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6242
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6243
	self primSetCurrentDirectoryA:pathName
12616
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6244
    ].
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6245
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6246
    "
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6247
     self getCurrentDirectory
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6248
     self setCurrentDirectory:'C:\Users\cg\work\stx\projects'
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6249
     self getCurrentDirectory
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6250
     self setCurrentDirectory:'C:\Users\cg\work\stx\projects\smalltalk'
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6251
    "
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6252
!
Claus Gittinger <cg@exept.de>
parents: 12603
diff changeset
  6253
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6254
setHidden:aPathName
12969
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  6255
    "set the hidden attribute. Return true if the operation succeeded"
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6256
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6257
    |attr|
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6258
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6259
    attr := self primGetFileAttributes:aPathName.
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6260
    (attr bitTest:FILE_ATTRIBUTE_HIDDEN ) ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6261
	^ self primSetFileAttributes:aPathName to:(attr bitOr:2).
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6262
    ].
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6263
    ^ true  "/ aready set
12969
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  6264
999e457ed11e added: #clearHidden:
sr
parents: 12961
diff changeset
  6265
    "Modified: / 29-07-2010 / 11:32:26 / sr"
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6266
!
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6267
10622
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6268
setNormal:aPathName
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6269
    " sets all file attributes to the normal state
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6270
      e.g. set the hidden attribute to false (unhidden)"
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6271
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6272
    |attr|
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6273
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6274
    attr := self primGetFileAttributes:aPathName.
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6275
    (attr bitTest:FILE_ATTRIBUTE_NORMAL ) ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6276
	^ self primSetFileAttributes:aPathName to:(attr bitOr:2).
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6277
    ].
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6278
    ^ true  "/ aready set
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6279
!
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6280
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6281
setTemporary:aPathName
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6282
    " set the temporary attribute of aPathName"
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6283
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6284
    |attr|
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6285
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6286
    attr := self primGetFileAttributes:aPathName.
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6287
    (attr bitTest:FILE_ATTRIBUTE_TEMPORARY ) ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6288
	^ self primSetFileAttributes:aPathName to:(attr bitOr:2).
12387
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6289
    ].
d88c55848b54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12154
diff changeset
  6290
    ^ true  "/ aready set
10622
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6291
!
87a51cae9161 added #setHidden: and #setNormal:
sr
parents: 10615
diff changeset
  6292
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6293
timeOfLastAccess:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6294
    "return the time, when the file was last accessed.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6295
     For nonexistent files, nil is returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6296
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6297
    "could be implemented as:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6298
	(self infoOf:aPathName) accessed
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6299
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6300
    | i|
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
    i := self infoOf:aPathName.
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  6303
    i notNil ifTrue:[^ i accessTime].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6304
    ^ nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6305
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6306
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6307
     OperatingSystem timeOfLastAccess:'/'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6308
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6309
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6310
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6311
timeOfLastChange:aPathName
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6312
    "return the time, when the file was last changed.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6313
     For nonexistent files, nil is returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6314
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6315
    "could be implemented as:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6316
	(self infoOf:aPathName) modified
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6317
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6318
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6319
    | i|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6320
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6321
    i := self infoOf:aPathName.
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  6322
    i notNil ifTrue:[^ i modificationTime].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6323
    ^ nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6324
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6325
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6326
     OperatingSystem timeOfLastChange:'/'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6327
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6328
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6329
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6330
typeOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6331
    "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
  6332
     nil is returned.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6333
     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
  6334
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6335
    |i|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6336
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6337
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6338
     this could have been implemented as:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6339
	(self infoOf:aPathName) type
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6340
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6341
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6342
    i := self infoOf:aPathName.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6343
    i notNil ifTrue:[^ i type].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6344
    ^ nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6345
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6346
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6347
     OperatingSystem typeOf:'/'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6348
     OperatingSystem typeOf:'.'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6349
     OperatingSystem typeOf:'Make.proto'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6350
     OperatingSystem typeOf:'resources/motif.style'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6351
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6352
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6353
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6354
volumeLabelOf: aFilenameOrString
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6355
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6356
	"Answer the volume label of the disk containing aFilenameOrString."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6357
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6358
    | volName |
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6359
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6360
    volName := String new: 255.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6361
    ( self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6362
	getVolumeInformation: aFilenameOrString asFilename volume, '\'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6363
	name: volName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6364
	nameSize: volName size
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6365
	serialNumber: nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6366
	maximumComponentLength: nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6367
	fileSystemFlags: nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6368
	fileSystemName: nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6369
	fileSystemNameSize: 0 )
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6370
	    ifFalse: [
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6371
		Transcript showCR:'GetVolumeInformation error'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6372
		^ ''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6373
	].
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6374
    ^ volName copyUpTo: Character null
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6375
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6376
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6377
	self volumeLabelOf: 'C:\pepe.pep'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6378
	self volumeLabelOf: 'C:'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6379
	self volumeLabelOf: 'C:\\'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6380
	self volumeLabelOf: 'C:\'
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6381
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6382
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6383
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  6384
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6385
volumeNameOf:aPathString
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6386
    "return the volumeName of the argument, aPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6387
     - thats the name of the volume where aPath is.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6388
     Not all OperatingSystem support/use volumes; on unix,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6389
     this always returns an empty string."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6390
7102
415388639cdd changes claus
penk
parents: 7080
diff changeset
  6391
    aPathString size < 2 ifTrue:[^ ''].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6392
    (aPathString at:2) == $: ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6393
	^ (aPathString at:1) asString.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6394
    ].
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
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6397
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  6398
!Win32OperatingSystem class methodsFor:'help support'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  6399
9988
0126451578fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9955
diff changeset
  6400
openDocumentationFilename: aFilenameOrString
12154
646c4171f0d2 added: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 11920
diff changeset
  6401
    <resource: #obsolete>
646c4171f0d2 added: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 11920
diff changeset
  6402
646c4171f0d2 added: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 11920
diff changeset
  6403
    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
  6404
9990
19a95e470d32 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9988
diff changeset
  6405
    "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
  6406
     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
  6407
     html documents, pdf documents etc."
19a95e470d32 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9988
diff changeset
  6408
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  6409
    Error
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6410
	handle:[:ex |
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6411
	    Dialog warn:'Shell execution failed'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6412
	] do:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6413
	    self openApplicationForDocument:aFilenameOrString operation:#open
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6414
	]
9988
0126451578fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9955
diff changeset
  6415
0126451578fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9955
diff changeset
  6416
    "
0126451578fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9955
diff changeset
  6417
     self openDocumentationFilename: 'C:\WINDOWS\Help\clipbrd.chm' asFilename
10364
43968474508b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10352
diff changeset
  6418
     self openDocumentationFilename: Filename currentDirectory
9988
0126451578fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9955
diff changeset
  6419
    "
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  6420
c57956a348bf printing support
fm
parents: 9431
diff changeset
  6421
    "Created: / 04-08-2006 / 18:04:52 / fm"
10364
43968474508b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10352
diff changeset
  6422
    "Modified: / 26-01-2007 / 14:05:44 / cg"
10160
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6423
!
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6424
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6425
openHelpFile: helpFilename inContextID: contextID withOwner: anApplicationModel
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6426
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6427
    |ownerHandle macro|
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6428
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6429
    anApplicationModel notNil ifTrue:[ownerHandle := anApplicationModel window id].
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6430
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6431
    contextID isNil ifTrue: [^self primWinHelp: ownerHandle helpFile: helpFilename command: 3 "HelpIndex" dwData: nil ].
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6432
    contextID isInteger ifTrue: [^self primWinHelp: ownerHandle helpFile: helpFilename command: 1 "HelpContext" dwData: contextID ].
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6433
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6434
    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
  6435
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6436
    macro := 'JumpId("', helpFilename asFilename baseName , '", "', contextID, '")'.
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6437
    self primWinHelp: nil helpFile: helpFilename command: 258 "HelpCommand" dwData: macro
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6438
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6439
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6440
"
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6441
    self openHelpFile: 'C:\vsw311\dapas.hlp' inContextID: 'IDH_ACI' withOwner: nil
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6442
"
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6443
!
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6444
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6445
primWinHelp: hWnd helpFile: aString command: anInteger dwData: anObject
10276
1e689abbfb18 #primWinHelp: helpFile: command: dwData:
fm
parents: 10274
diff changeset
  6446
    <apicall: bool "WinHelpA" ( handle lpstr int32 lpstr ) module: "user32.dll" >
10160
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6447
    self primitiveFailed.
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6448
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  6449
"
10160
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6450
    anInteger
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6451
    - 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
  6452
    - 3         HelpIndex       to open in the help index
10160
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6453
    - 258       HelpCommand     execute a macro string
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6454
"
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6455
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6456
"
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  6457
    self primWinHelp: nil helpFile: 'C:\vsw311\dapas.hlp' command: 3 dwData: nil
10160
2fe3c748e688 open help file in contextID
fm
parents: 10159
diff changeset
  6458
"
10276
1e689abbfb18 #primWinHelp: helpFile: command: dwData:
fm
parents: 10274
diff changeset
  6459
1e689abbfb18 #primWinHelp: helpFile: command: dwData:
fm
parents: 10274
diff changeset
  6460
    "Modified: / 19-12-2006 / 11:48:15 / User"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  6461
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
  6462
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6463
!Win32OperatingSystem class methodsFor:'interrupts & signals'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6464
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6465
blockingTest
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6466
    "this is a test method;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6467
     For testing double CTRL-C in blocking primitives"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6468
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6469
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6470
    while(1) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6471
	console_printf("blocking...");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6472
	Sleep(50);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6473
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6474
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6475
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6476
     OperatingSystem blockingTest
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6477
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6478
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6479
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6480
blockingTest2
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6481
    "this is a test method;
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6482
     For testing single CTRL-C in blocking primitives"
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6483
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6484
%{
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6485
    while(1) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6486
	console_printf("blocking...");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6487
	STX_API_CALL1("Sleep", Sleep, 50);
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6488
    }
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6489
%}.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6490
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6491
     OperatingSystem blockingTest2
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6492
    "
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6493
!
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6494
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6495
blockingTest3
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6496
    "this is a test method;
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6497
     For testing single CTRL-C in non-interruptable blocking primitives.
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6498
     This one should continue after typing continue in the debugger"
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6499
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6500
%{
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6501
    int ret;
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6502
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6503
    do {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6504
	// do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6505
	ret = STX_API_NOINT_CALL1("Sleep", Sleep, 60000);
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6506
    } while (ret < 0 && __threadErrno == EINTR);
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6507
%}.
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6508
    "
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6509
     OperatingSystem blockingTest3
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6510
    "
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6511
!
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6512
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6513
blockingTest4
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6514
    "this is a test method;
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6515
     For testing single CTRL-C in non-interruptable blocking primitives.
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6516
     This one start a new sleep after typing continue in the debugger"
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6517
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6518
%{
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6519
    int ret;
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6520
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6521
    do {
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  6522
	// do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6523
	ret = STX_API_CALL1("Sleep", Sleep, 60000);
12730
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6524
    } while (ret < 0 && __threadErrno == EINTR);
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6525
%}.
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6526
    "
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6527
     OperatingSystem blockingTest4
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6528
    "
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6529
!
Stefan Vogel <sv@exept.de>
parents: 12715
diff changeset
  6530
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6531
defaultSignal:signalNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6532
    "revert to the default action on arrival of a (Unix-)signal.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6533
     Dont confuse Unix signals with smalltalk signals.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6534
     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
  6535
     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
  6536
     default for SIGQUIT (^ \) is to dump core.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6537
     Also, NOTICE that signal numbers are not portable between unix
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6538
     systems - use OperatingSystem sigXXX to get the numeric value for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6539
     a signal."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6540
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6541
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6542
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6543
    if (__isSmallInteger(signalNumber)) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6544
#ifdef SIG_DFL
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6545
	signal(__intVal(signalNumber), SIG_DFL);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6546
	RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6547
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6548
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6549
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6550
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6551
     this error is triggered on non-integer argument
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6552
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6553
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6554
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6555
    "you better save a snapshot image before trying this ..."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6556
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6557
     'if you hit ^C now, Smalltalk will exit immediately' printNewline.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6558
     OperatingSystem defaultSignal:(OperatingSystem sigINT).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6559
     1 to:1000000 do:[:i| ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6560
     OperatingSystem enableSignal:(OperatingSystem sigINT).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6561
     'normal ^C handling again.' printNewline
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6562
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6563
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6564
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6565
disableIOInterruptsOn:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6566
    "turn off IO interrupts for a filedescriptor"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6567
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6568
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6569
     this error is triggered on non-integer argument
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6570
     or if the OS does not support IO interrupts.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6571
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6572
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6573
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6574
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6575
disableSignal:signalNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6576
    "disable (Unix-) signal processing for signalNumber.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6577
     Dont confuse Unix signals with smalltalk signals.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6578
     WARNING: for some signals, it is no good idea to disable
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6579
     them; for example, disabling the SIGINT signal turns off ^C
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6580
     handling.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6581
     Also, NOTICE that signal numbers are not portable between unix
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6582
     systems - use OperatingSystem sigXXX to get the numeric value for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6583
     a signal.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6584
     Use only for fully debugged stand alone applications."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6585
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6586
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6587
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6588
    if (__isSmallInteger(signalNumber)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6589
	int sigNo = __intVal(signalNumber);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6590
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6591
	if (sigNo == 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6592
	    RETURN (self);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6593
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6594
#ifdef SIG_IGN
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6595
	signal(sigNo, SIG_IGN);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6596
	RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6597
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6598
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6599
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6600
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6601
     this error is triggered on non-integer argument
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6602
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6603
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6604
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6605
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6606
     'now, ^C is totally ignored ...' printNewline.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6607
     OperatingSystem disableSignal:(OperatingSystem sigINT).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6608
     1 to:1000000 do:[:i| ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6609
     OperatingSystem enableSignal:(OperatingSystem sigINT).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6610
     '^C handled again.' printNewline
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6611
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6612
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6613
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6614
disableTimer
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6615
    "disable timer interrupts.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6616
     WARNING:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6617
	the system will not operate correctly with timer interrupts
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6618
	disabled, because no scheduling or timeouts are possible."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6619
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6620
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6621
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6622
    extern void __win32ClearTimer();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6623
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6624
    __win32ClearTimer();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6625
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6626
    ^ true
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6629
enableChildSignalInterrupts
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6630
    "enable childSignal interrupts
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6631
     (SIGCHLD, if the architecture supports it).
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6632
     After enabling, these signals will send the message
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6633
     'childSignalInterrupt' to the ChildSignalInterruptHandler object."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6634
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6635
    self enableSignal:(self sigCHLD)
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
enableIOInterruptsOn:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6639
    "turn on IO interrupts for a filedescriptor"
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
     this error is triggered on non-integer argument
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6643
     or if the system does not support SIGIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6644
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6645
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6646
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6647
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6648
enableSignal:signalNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6649
    "enable (Unix-)signal processing for signalNumber.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6650
     Dont confuse Unix signals with smalltalk signals.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6651
     The signal will be delivered to one of the standard handlers
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6652
     (SIGINT, SIGQUIT, etc) or to a general handler, which
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6653
     sends #signalInterrupt:.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6654
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6655
     NOTICE that signal numbers are not portable between unix
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6656
     systems - use OperatingSystem sigXXX to get the numeric value for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6657
     a signal."
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6660
11669
db58374346b3 Define (and handle) the HUP and PWR signals
Stefan Vogel <sv@exept.de>
parents: 11623
diff changeset
  6661
# define SIG_LIMIT 30
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6662
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6663
#if defined(SIGPOLL) && !defined(SIGIO)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6664
# define SIGIO SIGPOLL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6665
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6666
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6667
#ifdef SIGCHLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6668
# define CHILD_SIGNAL   SIGCHLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6669
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6670
# ifdef SIGCLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6671
#  define CHILD_SIGNAL  SIGCLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6672
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6673
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6674
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6675
    int sigNr;
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
#if defined(SIGINT) || defined(SIGQUIT)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6678
# ifndef __signalUserInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6679
    extern void __signalUserInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6680
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6681
#endif
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
#ifdef SIGFPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6684
# ifndef __signalFpExceptionInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6685
    extern void __signalFpExceptionInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6686
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6687
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6688
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6689
#ifdef SIGIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6690
# ifndef __signalIoInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6691
    extern void __signalIoInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6692
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6693
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6694
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6695
#ifdef CHILD_SIGNAL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6696
# ifndef __signalChildInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6697
    extern void __signalChildInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6698
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6699
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6700
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6701
#ifdef SIGPIPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6702
# ifndef __signalPIPEInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6703
    extern void __signalPIPEInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6704
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6705
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6706
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6707
#ifdef SIGBUS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6708
# ifndef __signalBUSInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6709
    extern void __signalBUSInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6710
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6711
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6712
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6713
#ifdef SIGSEGV
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6714
# ifndef __signalSEGVInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6715
    extern void __signalSEGVInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6716
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6717
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6718
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6719
#if defined(SIGILL) || defined(SIGEMT)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6720
# ifndef __signalTrapInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6721
    extern void __signalTrapInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6722
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6723
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6724
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6725
#ifdef SIGALRM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6726
# ifndef WIN32
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6727
#  ifndef __signalTimerInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6728
    extern void __signalTimerInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6729
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6730
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6731
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6732
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6733
#ifndef __signalInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6734
    extern void __signalInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6735
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6736
    void (*handler)(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6737
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6738
    if (__isSmallInteger(signalNumber)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6739
     && ((sigNr = __intVal(signalNumber)) >= 0)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6740
#ifdef SIG_LIMIT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6741
     &&  (sigNr <= SIG_LIMIT)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6742
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6743
    ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6744
	/*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6745
	 * standard signals are forced into standard handlers
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6746
	 * - all others go into general signalInterrupt
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6747
	 */
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6748
#if defined(SIGPOLL) && defined(SIGIO)
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6749
	if (sigNr == SIGPOLL)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6750
	    sigNr = SIGIO;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6751
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6752
	switch (sigNr) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6753
	    case 0:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6754
		/* enabling a non-supported signal */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6755
		RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6756
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6757
#ifdef SIGBREAK
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6758
	    case SIGBREAK:
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6759
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6760
#ifdef SIGINT
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6761
	    case SIGINT:
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6762
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6763
#ifdef SIGQUIT
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6764
	    case SIGQUIT:
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6765
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6766
#ifdef SIGNALDEBUGWIN32
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6767
		console_printf("ConsoleSignal %d\n",sigNr);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6768
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6769
		SetConsoleCtrlHandler((PHANDLER_ROUTINE)__signalUserInterruptWIN32,TRUE);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6770
		RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6771
#ifdef SIGFPE
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6772
	    case SIGFPE:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6773
		handler = __signalFpExceptionInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6774
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6775
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6776
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6777
#ifdef SIGPIPE
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6778
	    case SIGPIPE:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6779
		handler = __signalPIPEInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6780
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6781
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6782
#ifdef SIGBUS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6783
	    case SIGBUS:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6784
		handler = __signalBUSInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6785
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6786
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6787
#ifdef SIGSEGV
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6788
	    case SIGSEGV:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6789
		handler = __signalSEGVInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6790
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6791
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6792
#ifdef SIGILL
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6793
	    case SIGILL:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6794
		handler = __signalTrapInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6795
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6796
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6797
#ifdef SIGEMT
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6798
	    case SIGEMT:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6799
		handler = __signalTrapInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6800
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6801
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6802
#ifdef SIGIO
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6803
	    case SIGIO:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6804
		handler = __signalIoInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6805
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6806
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6807
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6808
#ifdef CHILD_SIGNAL
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6809
	    case CHILD_SIGNAL:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6810
		handler = __signalChildInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6811
		break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6812
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6813
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6814
	    default:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6815
		handler = __signalInterrupt;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6816
		break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6817
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6818
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6819
	{
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6820
#ifdef HAS_SIGACTION
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6821
	    struct sigaction act;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6822
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6823
	    /*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6824
	     * Do not add SA_RESTART here. A signal can cause a
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6825
	     * thread switch, another thread can do a garbage collect
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6826
	     * and restarted system calls may write into old
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6827
	     * (collected) addresses.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6828
	     */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6829
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6830
	    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
  6831
	    sigemptyset(&act.sa_mask);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6832
	    act.sa_handler = handler;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6833
	    sigaction(sigNr, &act, 0);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6834
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6835
# ifdef HAS_SIGVEC
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6836
	    struct sigvec vec;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6837
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6838
	    vec.sv_flags = SV_INTERRUPT;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6839
	    sigemptyset(&vec.sv_mask);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6840
	    vec.sv_handler = handler;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6841
	    sigvec(sigNr, &vec, NULL);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6842
# else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6843
#  ifdef WIN32
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6844
#   ifdef SIGNALDEBUGWIN32
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6845
	    console_printf("signal %d can't change handler\n",sigNr);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6846
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6847
#  else
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6848
	    (void) signal(sigNr, handler);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6849
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6850
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6851
#endif
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6852
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6853
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6854
	/*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6855
	 * maybe, we should Return the old enable-status
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6856
	 * as boolean here ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6857
	 */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6858
	RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6859
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6860
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6861
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6862
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6863
     this error is triggered on non-integer argument, or
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6864
     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
  6865
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6866
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6867
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6868
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6869
enableTimer:milliSeconds
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6870
    "setup for a timerInterrupt, to be signalled after some (real) time."
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
    extern void __win32SetTimer();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6874
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6875
    if (__isSmallInteger(milliSeconds)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6876
	__win32SetTimer( __intVal(milliSeconds) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6877
	RETURN (true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6878
    }
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
    ^ false
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
6535
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  6883
isFatalSignal:aNumber
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  6884
   "return true if a signal with number aNumber is a fatal signal,
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  6885
    i.e. some severe internal error occured"
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  6886
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  6887
   ^ (aNumber == self sigSEGV)
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  6888
     or:[aNumber == self sigILL
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  6889
     or:[aNumber == self sigBUS]]
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  6890
!
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  6891
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6892
killProcess:processId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6893
    "kill a process.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6894
     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
  6895
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6896
     WARNING: in order to avoid zombie processes (on unix),
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6897
	      you have to fetch the processes exitstatus with
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6898
	      OperatingSystem>>getStatusOfProcess:aProcessId."
5133
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
    self terminateProcess:processId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6901
!
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
sendSignal:signalNumber to:processId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6904
    "send a unix signal to some process (maybe myself).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6905
     Returns false if any error occurred, true otherwise.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6906
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6907
     Do not confuse UNIX signals with Smalltalk-Signals.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6908
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6909
     WARNING: in order to avoid zombie processes (on unix),
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6910
	      you may have to fetch the processes exitstatus with
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6911
	      OperatingSystem>>getStatusOfProcess:aProcessId
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6912
	      if the signal terminates that process."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6913
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6914
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6915
    "/ either invalid argument (non-integers)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6916
    "/ or not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6917
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6918
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6919
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6920
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  6921
terminateProcess:processHandleOrPid
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6922
    "terminate a process.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6923
     The process has a chance to do some cleanup.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6924
     WIN32:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6925
	 Under unix, we have terminateProcess, which does a soft
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6926
	 terminate (giving the process a chance to cleanup) and
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6927
	 killProcess, which does a hard terminate.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6928
	 Under WIN32, both (currently) use the TerminateProcess
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6929
	 function, which unconditionally causes a process to exit.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6930
	 I.e. under WIN32, the process has no chance to perform cleanup.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6931
	 Use it only in extreme circumstances. The state of
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6932
	 global data maintained by dynamic-link libraries (DLLs)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6933
	 may be compromised if TerminateProcess is used.
7065
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  6934
     TODO: send it a WM_QUIT instead, to allow for proper shutdown."
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  6935
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  6936
    self terminateProcess:processHandleOrPid exitCode:0
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  6937
!
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  6938
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  6939
terminateProcess:processHandleOrPid exitCode:exitCode
7065
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  6940
    "terminate a process.
7645
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  6941
     The process should have a chance to do some cleanup.
7065
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  6942
     WIN32:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6943
	 Under unix, we have terminateProcess, which does a soft
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6944
	 terminate (giving the process a chance to cleanup) and
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6945
	 killProcess, which does a hard terminate.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6946
	 Under WIN32, both (currently) use the TerminateProcess
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6947
	 function, which unconditionally causes a process to exit.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6948
	 I.e. under WIN32, the process has no chance to perform cleanup.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6949
	 Use it only in extreme circumstances. The state of
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6950
	 global data maintained by dynamic-link libraries (DLLs)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6951
	 may be compromised if TerminateProcess is used.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6952
     TODO: send it a WM_QUIT instead, to allow for proper shutdown."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6953
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6954
%{
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  6955
    if (__isExternalAddressLike(processHandleOrPid) ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6956
	HANDLE hProcess = _HANDLEVal(processHandleOrPid);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6957
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6958
	if (hProcess != 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6959
	    TerminateProcess( hProcess, __intVal(exitCode) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6960
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6961
	RETURN( true );
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  6962
    } else if( __isSmallInteger(processHandleOrPid) ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6963
	HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, 0, __smallIntegerVal(processHandleOrPid));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6964
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6965
	if( hProcess != 0 ) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6966
	    TerminateProcess( hProcess, __intVal(exitCode) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6967
	    CloseHandle(hProcess);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6968
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  6969
	RETURN( true );
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  6970
    }
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  6971
%}.
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  6972
    self primitiveFailed:#invalidParameter.
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  6973
5133
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
    "Modified: / 28.12.1995 / 15:05:37 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6976
    "Modified: / 27.1.1998 / 20:05:47 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6977
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6978
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  6979
terminateProcessGroup:processGroupHandleOrPid
14832
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  6980
    "terminate a process group (that is all subprocesses of a process)."
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  6981
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  6982
    | pid list groupsToTerminate anyMore |
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  6983
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  6984
    list := self getAllProcesses.
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  6985
    list size == 0 ifTrue:[^ self ].
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  6986
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  6987
    processGroupHandleOrPid isInteger ifTrue:[
15546
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  6988
	pid := processGroupHandleOrPid
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  6989
    ] ifFalse:[
15546
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  6990
	pid := processGroupHandleOrPid pid.
14832
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  6991
    ].
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  6992
    groupsToTerminate := Set with:pid.
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  6993
    list := list asSet.
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  6994
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  6995
    "/ Transcript show:'terminate group '; showCR:pid.
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  6996
    anyMore := true.
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  6997
    [anyMore] whileTrue:[
15546
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  6998
	anyMore := false.
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  6999
	list doWithExit:[:anOSProcess :exit |
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  7000
	    |pid|
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  7001
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  7002
	    (groupsToTerminate includes:anOSProcess parentPid) ifTrue:[
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  7003
		pid := anOSProcess pid.
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  7004
		groupsToTerminate add:pid.
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  7005
		"/ Transcript show:'terminate '; showCR:pid.
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  7006
		self terminateProcess:( pid ).
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  7007
		list remove:anOSProcess.
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  7008
		anyMore := true.
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  7009
		"/ need to restart: we have removed an element inside the loop
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  7010
		exit value:nil
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  7011
	    ].
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  7012
	].
14832
b010cb2aa396 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14783
diff changeset
  7013
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7014
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7015
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7016
!Win32OperatingSystem class methodsFor:'ipc support'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7017
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7018
makePipe
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7019
    "make a pipe, return array with two filedescriptors on success,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7020
     nil on failure.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7021
     This is a lowLevel entry, not for public use.
12686
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7022
     See NonPositionableExternalStream>>makePipe for a more user-friendly, public interface."
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7023
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7024
    |fd1 fd2 error|
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7025
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7026
%{
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7027
    HANDLE   pipeRead  = (HANDLE)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7028
    HANDLE   pipeWrite = (HANDLE)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7029
8667
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  7030
    SECURITY_ATTRIBUTES sa;
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  7031
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  7032
    ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES));
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  7033
    sa.nLength = sizeof(SECURITY_ATTRIBUTES);
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  7034
    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
  7035
    // 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
  7036
    sa.bInheritHandle = FALSE;
8667
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  7037
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  7038
    if( ! CreatePipe( &pipeRead, &pipeWrite, &sa, 0 ) ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7039
	@global(LastErrorNumber) = error = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7040
	goto out;
12686
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7041
    }
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7042
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7043
#if 1
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7044
    fd1 = __MKEXTERNALADDRESS(pipeRead);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7045
    fd2 = __MKEXTERNALADDRESS(pipeWrite);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7046
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7047
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7048
     * make fileDescriptors from handles
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7049
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7050
# ifdef PROCESSDEBUGWIN32
10352
f2e9bb8906db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10342
diff changeset
  7051
    console_printf("piperead %x\n",pipeRead);
f2e9bb8906db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10342
diff changeset
  7052
    console_printf("pipewrite %x\n",pipeWrite);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7053
# endif
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7054
    fd1 = __mkSmallInteger(_open_osfhandle(pipeRead, O_BINARY));
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7055
    fd2 = __mkSmallInteger(_open_osfhandle(pipeWrite, O_BINARY));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7056
#endif
12686
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7057
out:;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7058
%}.
10627
bef737d1b8a7 care for -1 fd returned by CreatePipe
Claus Gittinger <cg@exept.de>
parents: 10622
diff changeset
  7059
    (fd1 notNil and:[fd2 notNil]) ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7060
	(fd1 ~~ -1 and:[fd2 ~~ -1]) ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7061
	    ^ Array with:fd1 with:fd2.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7062
	].
12686
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7063
    ].
27afd11a1acd changed:
Stefan Vogel <sv@exept.de>
parents: 12654
diff changeset
  7064
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7065
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7066
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7067
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7068
!Win32OperatingSystem class methodsFor:'misc'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7069
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7070
closePid:pid
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7071
    "free pid resource"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7072
%{
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  7073
    if (__isExternalAddressLike(pid) ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7074
	HANDLE __pid = _HANDLEVal(pid);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7075
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7076
	if (__pid != 0) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7077
#ifdef PROCESSDEBUGWIN32
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7078
	    console_printf("Close ProcessHandle %x\n", __pid);
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
	    CloseHandle(__pid);
14636
26765f6a6b11 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14632
diff changeset
  7081
	    _SETHANDLEVal(pid, 0);
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7082
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7083
    }
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
    ^ true.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7086
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7087
    "Created: 28.1.1998 / 14:23:04 / md"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7088
    "Modified: 28.1.1998 / 14:27:18 / md"
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7089
!
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7090
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7091
duplicateHandle:aHandle to:targetProcessHandle
14520
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7092
    |hMe spaceForTargetHandle rslt addr|
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7093
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7094
    spaceForTargetHandle := ExternalLong unprotectedNew.
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7095
    hMe := self getCurrentProcess.
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  7096
    rslt := self
16279
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7097
                primDuplicateHandle_hSourcProcessHandle:hMe
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7098
                hSourceHandle:aHandle
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7099
                hTargetProcesshandle:targetProcessHandle ? hMe
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7100
                lpTargetHandle:spaceForTargetHandle
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7101
                dwDesiredAccess:0
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7102
                bInheritHandle:false
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7103
                dwOptions:2 "DUPLICATE_SAME_ACCESS".
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7104
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7105
    rslt ifFalse:[
16279
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7106
        spaceForTargetHandle free.
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7107
        self primitiveFailed:self primGetLastError.
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7108
        ^ nil
14520
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7109
    ].
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7110
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7111
    addr := spaceForTargetHandle value.
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7112
    spaceForTargetHandle free.
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7113
    ^ ExternalAddress newAddress:addr.
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7114
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7115
    "Created: / 18-09-2007 / 16:34:25 / cg"
14520
cc5f9141dded changed: #duplicateHandle:to:
anwild
parents: 14519
diff changeset
  7116
    "Modified: / 21-11-2012 / 12:14:06 / anwild"
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7117
!
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7118
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7119
getAllProcesses
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7120
    "answer a sequence of OSProcess, all processes running in system"
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7121
15546
d1d19176babd some stuff with inheriting handles
Claus Gittinger <cg@exept.de>
parents: 15544
diff changeset
  7122
    |list st_perProc f|
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7123
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7124
    list := OrderedCollection new.
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7125
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7126
%{
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7127
#ifdef TLHELP32_H_INCLUDE
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7128
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7129
    HANDLE hProcessSnap;
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7130
    PROCESSENTRY32 pe32;
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7131
    hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7132
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7133
    if( hProcessSnap != INVALID_HANDLE_VALUE ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7134
	pe32.dwSize = sizeof(PROCESSENTRY32);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7135
	Process32First( hProcessSnap, & pe32 );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7136
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7137
	do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7138
	    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
  7139
	    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
  7140
	    __SSEND1(st_perProc, @symbol(commandLine:), 0, f );
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7141
	    __SSEND1(st_perProc, @symbol(pid:), 0, __mkSmallInteger(pe32.th32ProcessID) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7142
	    __SSEND1(st_perProc, @symbol(parentPid:), 0, __mkSmallInteger(pe32.th32ParentProcessID) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7143
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7144
	    __SSEND1(list, @symbol(add:), 0, st_perProc );
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
	while(Process32Next(hProcessSnap,&pe32));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7147
	CloseHandle( hProcessSnap );
13128
35def02e40f4 CloseHandle added in: getAllProcesses
Michael Beyl <mb@exept.de>
parents: 13114
diff changeset
  7148
    }
35def02e40f4 CloseHandle added in: getAllProcesses
Michael Beyl <mb@exept.de>
parents: 13114
diff changeset
  7149
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7150
#endif  /* TLHELP32_H_INCLUDE */
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7151
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7152
%}.
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7153
    ^ list
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7154
!
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  7155
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7156
getCurrentProcess
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7157
    <apicall: handle "GetCurrentProcess" ( ) module: "kernel32.dll" >
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7158
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7159
    "
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7160
     self getCurrentProcess
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7161
    "
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7162
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7163
    "Created: / 18-09-2007 / 16:32:22 / cg"
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7164
!
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7165
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  7166
getPrivateProfileString:appNameString key:keyNameString default:defaultString fileName:fileName
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7167
    ^ self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7168
	getProfileString:appNameString key:keyNameString default:defaultString
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7169
	fileName:fileName private:true
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7170
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7171
    "Modified: / 27-07-2006 / 11:57:03 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7172
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7173
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  7174
getProfileString:appNameString key:keyNameString default:defaultString
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7175
%{
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7176
    char *__appNameString = NULL;
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7177
    char *__keyNameString = NULL;
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7178
    char *__defaultString = NULL;
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7179
    char *__returnedString = NULL;
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7180
    char quickBuffer[1024];
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7181
    char *usedBuffer = quickBuffer;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7182
    int bufferSize = sizeof(quickBuffer);
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7183
    int nChars;
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7184
    OBJ retVal;
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7185
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  7186
    if (__isStringLike(appNameString)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7187
	__appNameString = __stringVal(appNameString);
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7188
    } else if (appNameString != nil)
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7189
	goto primitiveFail;
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7190
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  7191
    if (__isStringLike(keyNameString)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7192
	__keyNameString = __stringVal(keyNameString);
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7193
    } else if (keyNameString != nil)
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7194
	goto primitiveFail;
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7195
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  7196
    if (__isStringLike(defaultString)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7197
	__defaultString = __stringVal(defaultString);
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7198
    } else if (defaultString != nil)
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7199
	goto primitiveFail;
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7200
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7201
    do {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7202
	nChars = GetProfileString(__appNameString, __keyNameString, __defaultString, usedBuffer, bufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7203
	if (nChars >= 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7204
	    if (nChars != bufferSize-1) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7205
		retVal = __MKSTRING_L(usedBuffer, nChars);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7206
		if (usedBuffer != quickBuffer) free(usedBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7207
		RETURN (retVal);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7208
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7209
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7210
	    {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7211
		/* use a bigger buffer */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7212
		char *newBuffer;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7213
		int newBufferSize = bufferSize * 2;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7214
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7215
		newBuffer = (char *)malloc( newBufferSize );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7216
		if (usedBuffer != quickBuffer) free(usedBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7217
		usedBuffer = newBuffer;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7218
		bufferSize = newBufferSize;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7219
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7220
	}
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  7221
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7222
    } while (nChars > 0);
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7223
    RETURN (nil);
9264
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7224
  primitiveFail: ;
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7225
%}.
2ad8f83a31ac +getPrivateprofileStrings
Claus Gittinger <cg@exept.de>
parents: 9257
diff changeset
  7226
    self primitiveFailed
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7227
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7228
    "Created: / 27-07-2006 / 11:54:59 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7229
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7230
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7231
getProfileString:appNameString key:keyNameString default:defaultString fileName:fileName private:private
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7232
%{
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7233
    char *__appNameString = NULL;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7234
    char *__keyNameString = NULL;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7235
    char *__defaultString = NULL;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7236
    char *__returnedString = NULL;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7237
    char *__fileName = NULL;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7238
    char quickBuffer[1024];
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7239
    char *usedBuffer = quickBuffer;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7240
    int bufferSize = sizeof(quickBuffer);
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7241
    int nChars;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7242
    OBJ retVal;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7243
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  7244
    if (__isStringLike(appNameString)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7245
	__appNameString = __stringVal(appNameString);
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7246
    } else if (appNameString != nil)
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7247
	goto primitiveFail;
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7248
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  7249
    if (__isStringLike(keyNameString)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7250
	__keyNameString = __stringVal(keyNameString);
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7251
    } else if (keyNameString != nil)
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7252
	goto primitiveFail;
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7253
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  7254
    if (__isStringLike(defaultString)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7255
	__defaultString = __stringVal(defaultString);
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7256
    } else if (defaultString != nil)
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7257
	goto primitiveFail;
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7258
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7259
    if (private == true) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7260
	if (! __isStringLike(fileName)) goto primitiveFail;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7261
	__fileName = __stringVal(fileName);
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7262
    }
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7263
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7264
    do {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7265
	if (private == true) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7266
	    nChars = GetPrivateProfileString(__appNameString, __keyNameString, __defaultString, usedBuffer, bufferSize, __fileName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7267
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7268
	    nChars = GetProfileString(__appNameString, __keyNameString, __defaultString, usedBuffer, bufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7269
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7270
	if (nChars >= 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7271
	    if (nChars != bufferSize-1) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7272
		retVal = __MKSTRING_L(usedBuffer, nChars);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7273
		if (usedBuffer != quickBuffer) free(usedBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7274
		RETURN (retVal);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7275
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7276
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7277
	    {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7278
		/* use a bigger buffer */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7279
		char *newBuffer;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7280
		int newBufferSize = bufferSize * 2;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7281
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7282
		newBuffer = (char *)malloc( newBufferSize );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7283
		if (usedBuffer != quickBuffer) free(usedBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7284
		usedBuffer = newBuffer;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7285
		bufferSize = newBufferSize;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7286
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7287
	}
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  7288
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7289
    } while (nChars > 0);
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7290
    RETURN (nil);
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7291
  primitiveFail: ;
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7292
%}.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7293
    self primitiveFailed
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7294
c57956a348bf printing support
fm
parents: 9431
diff changeset
  7295
    "Created: / 27-07-2006 / 11:55:25 / fm"
10274
a90d2c9d04b0 writePrivateProfileString
fm
parents: 10180
diff changeset
  7296
!
a90d2c9d04b0 writePrivateProfileString
fm
parents: 10180
diff changeset
  7297
10615
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7298
hInstance
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7299
    "very Win32 specific: get the HINSTANCE of the executable"
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7300
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7301
%{
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7302
    extern void *__getHInstance();
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7303
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7304
    RETURN (__MKEXTERNALADDRESS(__getHInstance()));
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7305
%}
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7306
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7307
    "
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7308
     Win32OperatingSystem hInstance
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7309
    "
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7310
!
349ffa5ea6d1 +hInstance
Claus Gittinger <cg@exept.de>
parents: 10596
diff changeset
  7311
16279
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7312
isValidHandle:anExternalAddress
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7313
    |newHandle|
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7314
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7315
    newHandle := self duplicateHandle:anExternalAddress to:nil.
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7316
    newHandle isNil ifTrue:[
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7317
        ^ false.
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7318
    ].
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7319
"/    self closeHandle:newHandle.
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7320
    ^ true.
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7321
!
1addd0eeec26 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15983
diff changeset
  7322
11767
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7323
playSound:fileName
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7324
    self playSound:fileName mode:1
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7325
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7326
"/#define SND_SYNC            0x0000  /* play synchronously (default) */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7327
"/#define SND_ASYNC           0x0001  /* play asynchronously */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7328
"/#define SND_NODEFAULT       0x0002  /* silence (!!default) if sound not found */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7329
"/#define SND_LOOP            0x0008  /* loop the sound until next sndPlaySound */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7330
"/#define SND_NOSTOP          0x0010  /* don't stop any currently playing sound */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7331
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7332
    "
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7333
     self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7334
	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
  7335
    "
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7336
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7337
    "Created: / 06-11-2007 / 00:46:57 / cg"
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7338
!
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7339
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7340
playSound:fileName mode:modeInteger
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7341
    <apicall: void "sndPlaySoundA" ( lpstr uint32) module: "winmm.dll" >
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7342
    self primitiveFailed.
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7343
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7344
"/#define SND_SYNC            0x0000  /* play synchronously (default) */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7345
"/#define SND_ASYNC           0x0001  /* play asynchronously */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7346
"/#define SND_NODEFAULT       0x0002  /* silence (!!default) if sound not found */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7347
"/#define SND_LOOP            0x0008  /* loop the sound until next sndPlaySound */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7348
"/#define SND_NOSTOP          0x0010  /* don't stop any currently playing sound */
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7349
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7350
    "
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7351
     self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7352
	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
  7353
	mode:1
11767
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7354
    "
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7355
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7356
    "Modified: / 06-11-2007 / 00:46:27 / cg"
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7357
!
057b2c8eba6f category change
Claus Gittinger <cg@exept.de>
parents: 11761
diff changeset
  7358
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7359
primCloseHandle: handle
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7360
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7361
    <apicall: ulongReturn "CloseHandle" ( handle ) module: "kernel32.dll" >
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7362
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7363
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  7364
primDuplicateHandle_hSourcProcessHandle:hSourceProcess
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7365
    hSourceHandle:hSourceHandle
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  7366
    hTargetProcesshandle:hTargetProcessHandle
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  7367
    lpTargetHandle:lpTargetHandle
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7368
    dwDesiredAccess:desiredAccess
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
  7369
    bInheritHandle:bInheritHandle
10720
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7370
    dwOptions:dwOptions
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7371
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7372
    <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
  7373
    self primitiveFailed.
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7374
4bb896884092 added duplicateHandle (must be tested)
Claus Gittinger <cg@exept.de>
parents: 10719
diff changeset
  7375
    "Created: / 18-09-2007 / 16:31:23 / cg"
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7376
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7377
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7378
primGetLastError
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7379
%{  /* NOCONTEXT */
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7380
    DWORD e;
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7381
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7382
    e = GetLastError();
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7383
    RETURN(__MKUINT(e));
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7384
%}.
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7385
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7386
    "/ <apicall: dword "GetLastError" () module: "kernel32.dll" >
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7387
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7388
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7389
	self primGetLastError
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7390
    "
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7391
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7392
15338
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7393
primSetLastError: i
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7394
%{  /* NOCONTEXT */
15338
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7395
    if (__isSmallInteger(i)) {
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7396
	SetLastError(__intVal(i));
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7397
	RETURN(self);
15338
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7398
    }
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7399
%}.
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7400
    self primitiveFailed.
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7401
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7402
   "/ <apicall: void "SetLastError" (dword) module: "kernel32.dll" >
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7403
419fe7273142 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15302
diff changeset
  7404
    "
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
  7405
	self primSetLastError: 0
11089
a6f47ff0561a mutex fix
fm
parents: 11088
diff changeset
  7406
    "
a6f47ff0561a mutex fix
fm
parents: 11088
diff changeset
  7407
!
a6f47ff0561a mutex fix
fm
parents: 11088
diff changeset
  7408
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7409
primWritePrivateProfileString: appName keyName: keyName profileString: profString fileName: aString
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7410
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7411
    <apicall: bool "WritePrivateProfileStringA" ( lpstr lpstr lpstr lpstr ) module: "Kernel32.dll" >
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7412
    ^self primitiveFailed
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7413
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7414
    "Created: / 18-12-2006 / 13:01:41 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7415
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7416
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7417
writePrivateProfileString: appName keyName: keyName profileString: profString fileName: aString
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7418
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7419
   ^self primWritePrivateProfileString: appName keyName: keyName profileString: profString fileName: aString
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7420
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7421
"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7422
    |profileStringToWrite recoveredProfileString|
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7423
    profileStringToWrite :=  'c:\vsw311'.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7424
    self writePrivateProfileString: 'PAV-Editor' keyName: 'ExportPath' profileString: profileStringToWrite fileName: 'C:\vsw311\dapas.ini'.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7425
    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
  7426
    self assert: (profileStringToWrite = recoveredProfileString).
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7427
"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7428
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  7429
    "Modified: / 18-12-2006 / 13:20:20 / User"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7430
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7431
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7432
!Win32OperatingSystem class methodsFor:'mutex'!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7433
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7434
createMutexNamed: name
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7435
    "Returns an array with the handle and the lastErrorCode"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7436
11089
a6f47ff0561a mutex fix
fm
parents: 11088
diff changeset
  7437
    |handle lastErrorCode|
a6f47ff0561a mutex fix
fm
parents: 11088
diff changeset
  7438
12986
bd31df28e32a changed: #createMutexNamed:
Claus Gittinger <cg@exept.de>
parents: 12970
diff changeset
  7439
    "/ "Without clear reasons, before creating the mutex we must call #printCR"
bd31df28e32a changed: #createMutexNamed:
Claus Gittinger <cg@exept.de>
parents: 12970
diff changeset
  7440
    "/ 'Creating mutex' printCR.
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7441
    self primSetLastError: 0.
11092
a05bd545f00d mutex fix
fm
parents: 11091
diff changeset
  7442
    self primGetLastError.
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7443
    handle := self primCreateMutex:nil initialOwner: true name: name.
11089
a6f47ff0561a mutex fix
fm
parents: 11088
diff changeset
  7444
    lastErrorCode := self primGetLastError.
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7445
    "/ lastErrorCode printCR.
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7446
11092
a05bd545f00d mutex fix
fm
parents: 11091
diff changeset
  7447
"/    self assert: lastErrorCode == 0.
11342
3a99bfdee484 changed #createMutexNamed:
fm
parents: 11291
diff changeset
  7448
"/    lastErrorCode == 5 "ERROR_ACCESS_DENIED" ifTrue:[Transcript showCR: 'Mutex not accesible (GetLastError = ERROR_ACCESS_DENIED)'.].
3a99bfdee484 changed #createMutexNamed:
fm
parents: 11291
diff changeset
  7449
"/    lastErrorCode == 183 "ERROR_ALREADY_EXISTS" ifTrue:[Transcript showCR: 'Mutex already exists (GetLastError = ERROR_ALREADY_EXISTS)'.].
11088
31c6b3e16450 mutex fix3
fm
parents: 11087
diff changeset
  7450
    (handle isNil or:[handle address ~~ 0]) ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7451
	Transcript showCR: 'CreateMutexNamed: "', name printString, '" failed'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7452
	handle := nil.
11342
3a99bfdee484 changed #createMutexNamed:
fm
parents: 11291
diff changeset
  7453
    ].
3a99bfdee484 changed #createMutexNamed:
fm
parents: 11291
diff changeset
  7454
    ^ Array with: handle with: lastErrorCode
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7455
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7456
    "
12986
bd31df28e32a changed: #createMutexNamed:
Claus Gittinger <cg@exept.de>
parents: 12970
diff changeset
  7457
     self createMutexNamed: '8906f5e0-54ed-11dd-9da4-001558137da0'
bd31df28e32a changed: #createMutexNamed:
Claus Gittinger <cg@exept.de>
parents: 12970
diff changeset
  7458
     self releaseMutexNamed: '8906f5e0-54ed-11dd-9da4-001558137da0'
bd31df28e32a changed: #createMutexNamed:
Claus Gittinger <cg@exept.de>
parents: 12970
diff changeset
  7459
    "
bd31df28e32a changed: #createMutexNamed:
Claus Gittinger <cg@exept.de>
parents: 12970
diff changeset
  7460
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7461
    "Modified: / 03-08-2010 / 16:57:36 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7462
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7463
11086
4c10b9d1ce49 mutex fix
fm
parents: 11085
diff changeset
  7464
existsMutexNamed: name
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7465
    |handle lastErrorCode handleAndLastErrorCode|
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7466
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7467
    handleAndLastErrorCode := self createMutexNamed: name.
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7468
    handle := handleAndLastErrorCode first.
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7469
    lastErrorCode := handleAndLastErrorCode second.
11092
a05bd545f00d mutex fix
fm
parents: 11091
diff changeset
  7470
"/    self assert: lastErrorCode == 0.
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7471
    ^ handle isNil
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7472
	or:[lastErrorCode == 183 "ERROR_ALREADY_EXISTS"
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7473
	    or:[ lastErrorCode == 5 "ERROR_ACCESS_DENIED"]]
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7474
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7475
    "Modified: / 03-08-2010 / 16:59:41 / cg"
11086
4c10b9d1ce49 mutex fix
fm
parents: 11085
diff changeset
  7476
!
4c10b9d1ce49 mutex fix
fm
parents: 11085
diff changeset
  7477
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7478
openMutexNamed: name
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7479
    "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
  7480
     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
  7481
     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
  7482
11088
31c6b3e16450 mutex fix3
fm
parents: 11087
diff changeset
  7483
    |handle |
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7484
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7485
    handle := self primOpenMutex:nil initialOwner: true name: name.
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7486
"/    lastErrorCode := self primGetLastError.
11088
31c6b3e16450 mutex fix3
fm
parents: 11087
diff changeset
  7487
"/    lastErrorCode = 2 ifTrue:[Transcript showCR: 'Mutex does not exist (GetLastError = ERROR_FILE_NOT_FOUND)'.].
31c6b3e16450 mutex fix3
fm
parents: 11087
diff changeset
  7488
"/    lastErrorCode = 5 ifTrue:[Transcript showCR: 'Mutex not accesible (GetLastError = ERROR_ACCESS_DENIED)'.].
31c6b3e16450 mutex fix3
fm
parents: 11087
diff changeset
  7489
    (handle isNil or:[handle address ~~ 0]) ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7490
	Transcript showCR: 'OpenMutexNamed: "', name printString, '" failed'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7491
	^ nil.
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7492
    ].
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7493
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7494
    ^ handle
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7495
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7496
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7497
    "
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7498
    self openMutexNamed: '8906f5e0-54ed-11dd-9da4-001558137da0'
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7499
    "
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7500
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7501
    "Modified: / 03-08-2010 / 16:59:37 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7502
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7503
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7504
primCreateMutex:lpSecurityDescriptor initialOwner: bInitialOwner name: lpName
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7505
    "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
  7506
     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
  7507
     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
  7508
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7509
    <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
  7510
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7511
    "Modified: / 03-08-2010 / 16:59:26 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7512
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7513
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7514
primOpenMutex:lpSecurityDescriptor initialOwner: bInitialOwner name: lpName
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7515
    "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
  7516
     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
  7517
     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
  7518
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7519
    <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
  7520
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7521
    "Modified: / 03-08-2010 / 16:59:11 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7522
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7523
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7524
primReleaseMutex: hMutex
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7525
    "If the function succeeds, the return value is nonzero.
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7526
     If the function fails, the return value is zero."
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7527
11085
ff0e28fd7027 changed #primReleaseMutex:
fm
parents: 11084
diff changeset
  7528
    <apicall: bool "ReleaseMutex" (handle) module: "kernel32.dll" >
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7529
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7530
    "Modified: / 03-08-2010 / 16:59:55 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7531
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7532
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7533
primWaitForSingleObject: handle milliseconds: dwMilliseconds
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7534
    "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
  7535
     If the function fails, the return value is WAIT_FAILED ((DWORD)0xFFFFFFFF)."
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7536
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7537
    <apicall: dword "WaitForSingleObject" (handle dword) module: "kernel32.dll" >
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7538
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7539
    "Modified: / 03-08-2010 / 17:00:02 / cg"
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7540
!
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7541
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7542
releaseMutex: hMutex
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7543
    "Returns true if the Mutex was released. Otherwise, returns false."
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7544
11085
ff0e28fd7027 changed #primReleaseMutex:
fm
parents: 11084
diff changeset
  7545
    | released|
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7546
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7547
    hMutex isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7548
	Transcript showCR: 'hMutex is nil - cannot release'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7549
	^ false
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7550
    ].
11085
ff0e28fd7027 changed #primReleaseMutex:
fm
parents: 11084
diff changeset
  7551
    released := self primReleaseMutex: hMutex.
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7552
    released ifFalse:[Transcript showCR: 'Release Mutex failed'.].
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7553
    ^ released
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7554
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7555
    "Modified: / 03-08-2010 / 17:00:05 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7556
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7557
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7558
releaseMutexNamed: name
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7559
    "Returns true if the Mutex was released. Otherwise, returns false."
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7560
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7561
    | hMutex |
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7562
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7563
    hMutex := self openMutexNamed: name.
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7564
    hMutex isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7565
	Transcript showCR: 'Cannot release Mutex named: "', name printString,'"'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7566
	^ false
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7567
    ].
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7568
    ^ self releaseMutex: hMutex.
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7569
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7570
    "Modified: / 03-08-2010 / 16:58:25 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7571
!
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7572
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
  7573
waitForSingleObject: handle
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7574
    |result|
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7575
11092
a05bd545f00d mutex fix
fm
parents: 11091
diff changeset
  7576
    result := self primWaitForSingleObject: handle milliseconds: 500.
11091
b64647b51eca mutex fix
fm
parents: 11090
diff changeset
  7577
    ^ result
12987
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7578
8adc5406f7cb comment/format in:5 methods
Claus Gittinger <cg@exept.de>
parents: 12986
diff changeset
  7579
    "Modified: / 03-08-2010 / 17:00:10 / cg"
11084
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7580
! !
34770cbaf50c mutex functions
fm
parents: 11034
diff changeset
  7581
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7582
!Win32OperatingSystem class methodsFor:'network resources'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7583
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7584
networkResourceAccessor
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7585
    "answer the Win32NetworkResourceHandle or nil if not supported"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7586
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7587
    ^ Win32NetworkResourceHandle
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7588
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
  7589
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7590
!Win32OperatingSystem class methodsFor:'os queries'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7591
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7592
executableFileExtensions
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7593
    "return a collection of extensions for executable program files.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7594
     Only req'd for msdos like systems ..."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7595
13616
69b0892613ed changed: #executableFileExtensions
Claus Gittinger <cg@exept.de>
parents: 13583
diff changeset
  7596
    ^ #('com' 'exe' 'bat')
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7597
13618
9af72c855037 Fixes for #canExecuteCommand:
vrany
parents: 13616
diff changeset
  7598
    "Created: / 02-05-1997 / 11:42:29 / cg"
9af72c855037 Fixes for #canExecuteCommand:
vrany
parents: 13616
diff changeset
  7599
    "Modified: / 23-08-2011 / 21:14:45 / jv"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7600
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7601
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7602
getDomainName
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  7603
    "return the DNS domain this host is in.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7604
     Notice:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7605
	not all systems support this; on some, 'unknown' is returned."
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  7606
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  7607
    |domainName idx hostName k|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7608
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7609
    DomainName notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7610
	^ DomainName
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  7611
    ].
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  7612
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  7613
    "/ sometimes, we can extract the domainName from the hostName ...
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  7614
    hostName := self getHostName.
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  7615
    hostName notEmptyOrNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7616
	idx := hostName indexOf:$..
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7617
	idx ~~ 0 ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7618
	    domainName := hostName copyFrom:idx+1.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7619
	]
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  7620
    ].
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  7621
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  7622
    domainName isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7623
	domainName := self getEnvironment:'DOMAIN'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7624
	domainName isNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7625
	    domainName := self getEnvironment:'DOMAINNAME'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7626
	].
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
	domainName isNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7629
	    "/ ok, search the registry ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7630
	    "/ under NT and later, it is found there ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7631
	    k := RegistryEntry key:'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7632
	    k notNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7633
		domainName := k valueNamed:'Domain'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7634
		k close.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7635
	    ].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7636
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7637
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7638
	domainName isNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7639
	    "/ under Win95/Win98, it is found there ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7640
	    k := RegistryEntry key:'HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7641
	    k notNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7642
		domainName := k valueNamed:'Domain'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7643
		k close.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7644
	    ]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7645
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7646
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7647
	domainName isNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7648
	    'Win32OperatingSystem [warning]: cannot find out domainName' errorPrintCR.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7649
	    domainName := 'unknown'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7650
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7651
	DomainName := domainName.     "cache only, if it is fixed"
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  7652
    ].
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  7653
    ^ domainName
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7654
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7655
    "
8659
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  7656
     DomainName := nil.
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  7657
     OperatingSystem getDomainName
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7658
     OperatingSystem getHostName
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7659
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7660
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7661
    "Modified: 26.4.1996 / 10:04:54 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7662
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7663
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7664
getEnvironment:aStringOrSymbol
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7665
    "get an environment string"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7666
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7667
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7668
    char *env;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7669
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
  7670
    if (__isStringLike(aStringOrSymbol)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7671
	char buff[1024];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7672
	int nNeeded;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7673
	OBJ ret = nil;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7674
13786
c7b1422f915d compile with msvc
Claus Gittinger <cg@exept.de>
parents: 13780
diff changeset
  7675
	nNeeded = GetEnvironmentVariableA(__stringVal(aStringOrSymbol),
c7b1422f915d compile with msvc
Claus Gittinger <cg@exept.de>
parents: 13780
diff changeset
  7676
					  buff,
c7b1422f915d compile with msvc
Claus Gittinger <cg@exept.de>
parents: 13780
diff changeset
  7677
					  sizeof(buff));
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7678
	if (nNeeded > sizeof(buff)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7679
	    char *buff2;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7680
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7681
	    buff2 = (char *)malloc(nNeeded);
13786
c7b1422f915d compile with msvc
Claus Gittinger <cg@exept.de>
parents: 13780
diff changeset
  7682
	    GetEnvironmentVariableA(__stringVal(aStringOrSymbol),
c7b1422f915d compile with msvc
Claus Gittinger <cg@exept.de>
parents: 13780
diff changeset
  7683
				    buff2,
c7b1422f915d compile with msvc
Claus Gittinger <cg@exept.de>
parents: 13780
diff changeset
  7684
				    nNeeded);
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7685
	    ret = __MKSTRING(buff2);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7686
	    free(buff2);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7687
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7688
	    if (nNeeded > 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7689
		ret = __MKSTRING(buff);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7690
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7691
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7692
	RETURN (ret);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7693
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7694
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7695
.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7696
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7697
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7698
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7699
     OperatingSystem getEnvironment:'LANG'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7700
     OperatingSystem getEnvironment:'LOGIN'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7701
     OperatingSystem getEnvironment:'HOME'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7702
     OperatingSystem getEnvironment:'NNTPSERVER'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7703
     OperatingSystem getEnvironment:'MAIL'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7704
     OperatingSystem getEnvironment:'PATH'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7705
    "
10294
f9fd95f04653 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10287
diff changeset
  7706
10297
d93eeb6c92eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10294
diff changeset
  7707
    "Modified: / 09-01-2007 / 20:14:35 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7708
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7709
8659
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  7710
getHostName
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  7711
    "return the hostname we are running on
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  7712
      - if possible, the fully qualified host name."
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  7713
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  7714
    |hostName|
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  7715
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  7716
%{  /* STACK: 2048 */
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  7717
#if defined(__MINGW32__)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  7718
    char bufferA[512];
14783
93bf8545cbd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14782
diff changeset
  7719
    DWORD buffSize = sizeof(bufferA);
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  7720
#else
14083
eace28be0149 changed: #getHostName
Stefan Vogel <sv@exept.de>
parents: 13956
diff changeset
  7721
    WCHAR buffer[512];
14087
6b3dea4f8fc9 changed: #getHostName
Stefan Vogel <sv@exept.de>
parents: 14083
diff changeset
  7722
    DWORD buffSize = sizeof(buffer)/sizeof(buffer[0]);
14783
93bf8545cbd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14782
diff changeset
  7723
#endif
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  7724
14083
eace28be0149 changed: #getHostName
Stefan Vogel <sv@exept.de>
parents: 13956
diff changeset
  7725
    // Note: GetComputerNameExA can fail in certain locales!
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  7726
#if defined(__MINGW32__)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  7727
    if (GetComputerNameA(bufferA, &buffSize) == TRUE) {
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  7728
	hostName = __MKSTRING_L(bufferA, buffSize);
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
  7729
    }
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
  7730
#else
14083
eace28be0149 changed: #getHostName
Stefan Vogel <sv@exept.de>
parents: 13956
diff changeset
  7731
    if (GetComputerNameExW(ComputerNameDnsFullyQualified, buffer, &buffSize) == TRUE) {
14364
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  7732
	hostName = __MKU16STRING_MAXLEN(buffer, buffSize);
14083
eace28be0149 changed: #getHostName
Stefan Vogel <sv@exept.de>
parents: 13956
diff changeset
  7733
    }
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
  7734
#endif
14083
eace28be0149 changed: #getHostName
Stefan Vogel <sv@exept.de>
parents: 13956
diff changeset
  7735
%}.
14088
751f95f1fff0 changed: #getHostName
Stefan Vogel <sv@exept.de>
parents: 14087
diff changeset
  7736
    hostName isNil ifTrue:[
14364
c2c870cc557c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14088
diff changeset
  7737
	^ nil.
14088
751f95f1fff0 changed: #getHostName
Stefan Vogel <sv@exept.de>
parents: 14087
diff changeset
  7738
    ].
14083
eace28be0149 changed: #getHostName
Stefan Vogel <sv@exept.de>
parents: 13956
diff changeset
  7739
    ^ hostName asSingleByteStringIfPossible
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7740
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7741
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7742
     OperatingSystem getHostName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7743
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7744
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7745
7775
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  7746
getLanguage
10311
1cf7f6da9fad comment
Claus Gittinger <cg@exept.de>
parents: 10297
diff changeset
  7747
    "get the LANGUAGE setting (example: de_DE.iso8859-15@euro).
1cf7f6da9fad comment
Claus Gittinger <cg@exept.de>
parents: 10297
diff changeset
  7748
     An environment value has higher preceedence than the system language setting."
9177
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  7749
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  7750
    |lang|
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  7751
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  7752
    lang := self getEnvironment:'LANG'.
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  7753
    (lang isNil or:[lang = 'default']) ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7754
	"/ ok, search the registry ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7755
	"/ under XP, it is found there ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7756
	lang := RegistryEntry
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7757
		    stringValueFor:'sLanguage'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7758
		    atKey:'HKEY_CURRENT_USER\Control Panel\International'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7759
	lang notNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7760
	    lang := self mapLanguage:lang.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7761
	].
7775
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  7762
    ].
9177
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  7763
    ^ lang
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  7764
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  7765
    "
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  7766
     OperatingSystem getLanguage
7775
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  7767
    "
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  7768
    "Modified: 26.4.1996 / 10:04:54 / stefan"
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  7769
!
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  7770
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7771
getLocaleInfo
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7772
    "return a dictionary filled with values from the locale information;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7773
     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
  7774
     Possible fields are:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7775
	decimalPoint                    <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7776
	thousandsSep                    <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7777
	internationalCurrencySymbol     <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7778
	currencySymbol                  <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7779
	monetaryDecimalPoint            <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7780
	monetaryThousandsSeparator      <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7781
	positiveSign                    <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7782
	negativeSign                    <String>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7783
	internationalFractionalDigits   <Integer>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7784
	fractionalDigits                <Integer>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7785
	positiveSignPrecedesCurrencySymbol      <Boolean>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7786
	negativeSignPrecedesCurrencySymbol      <Boolean>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7787
	positiveSignSeparatedBySpaceFromCurrencySymbol  <Boolean>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7788
	negativeSignSeparatedBySpaceFromCurrencySymbol  <Boolean>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7789
	positiveSignPosition                            <Symbol>
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7790
							one of: #parenthesesAround,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7791
								#signPrecedes,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7792
								#signSuceeds,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7793
								#signPrecedesCurrencySymbol,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7794
								#signSuceedsCurrencySymbol
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7795
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7796
	negativeSignPosition                            <like above>
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7797
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7798
     it is up to the application to deal with undefined values.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7799
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7800
     Notice, that (for now), the system does not use this information;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7801
     it should be used by applications as required.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7802
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7803
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7804
    |info val|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7805
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7806
    LocaleInfo notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7807
	"/ return the internal info; useful on systems which do not
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7808
	"/ support this.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7809
	^ LocaleInfo
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7810
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7811
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7812
    info := IdentityDictionary new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7813
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7814
    char *decimalPoint;         /* something like "." (US) or "," (german) */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7815
    char *thousandsSep;         /* something like "," (US) or "." (german) */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7816
    char *intCurrencySymbol;    /* international currency symbol; something like "USD "  "DM  " */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7817
    char *currencySymbol;       /* local currency symbol;         something like "USD "  "DM  " */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7818
    char *monDecimalPoint;      /* money: decimal point */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7819
    char *monThousandsSep;      /* money: thousands sep */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7820
    char *positiveSign;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7821
    char *negativeSign;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7822
    int   intFractDigits;       /* money: international digits after decPoint */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7823
    int   fractDigits;          /* money: local digits after decPoint */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7824
    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
  7825
    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
  7826
    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
  7827
    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
  7828
    int   csPosSignPosition;    /* money: 0: ()'s around the value & currency symbol */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7829
    int   csNegSignPosition;    /*        1: sign precedes the value & currency symbol */
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7830
				/*        2: sign succeeds the value & currency symbol */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7831
				/*        3: sign immediately precedes the currency symbol */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7832
				/*        4: sign immediately suceeds the currency symbol */
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7833
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7834
#if defined(HAS_LOCALECONV)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7835
    struct lconv *conf;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7836
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7837
    conf = localeconv();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7838
    if (conf) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7839
	decimalPoint = conf->decimal_point;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7840
	thousandsSep = conf->thousands_sep;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7841
	intCurrencySymbol = conf->int_curr_symbol;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7842
	currencySymbol = conf->currency_symbol;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7843
	monDecimalPoint = conf->mon_decimal_point;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7844
	monThousandsSep = conf->mon_thousands_sep;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7845
	positiveSign = conf->positive_sign;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7846
	negativeSign = conf->negative_sign;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7847
	intFractDigits = conf->int_frac_digits;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7848
	fractDigits = conf->frac_digits;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7849
	csPosPrecedes = conf->p_cs_precedes;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7850
	csNegPrecedes = conf->n_cs_precedes;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7851
	csPosSepBySpace = conf->p_sep_by_space;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7852
	csNegSepBySpace = conf->n_sep_by_space;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7853
	csPosSignPosition = conf->p_sign_posn;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7854
	csNegSignPosition = conf->n_sign_posn;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7855
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7856
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7857
    decimalPoint = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7858
    thousandsSep = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7859
    intCurrencySymbol = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7860
    currencySymbol = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7861
    monDecimalPoint = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7862
    monThousandsSep = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7863
    positiveSign =  (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7864
    negativeSign =(char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7865
    intFractDigits = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7866
    fractDigits = -1;
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7867
    csPosPrecedes = -1;
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7868
    csNegPrecedes = -1;
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7869
    csPosSepBySpace = -1;
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7870
    csNegSepBySpace = -1;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7871
    csPosSignPosition = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7872
    csNegSignPosition = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7873
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7874
    if (decimalPoint) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7875
	val = __MKSTRING(decimalPoint);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7876
	__AT_PUT_(info, @symbol(decimalPoint), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7877
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7878
    if (thousandsSep) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7879
	val = __MKSTRING(thousandsSep);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7880
	__AT_PUT_(info, @symbol(thousandsSeparator), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7881
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7882
    if (intCurrencySymbol) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7883
	val = __MKSTRING(intCurrencySymbol);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7884
	__AT_PUT_(info, @symbol(internationCurrencySymbol), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7885
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7886
    if (currencySymbol) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7887
	val = __MKSTRING(currencySymbol);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7888
	__AT_PUT_(info, @symbol(currencySymbol), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7889
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7890
    if (monDecimalPoint) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7891
	val = __MKSTRING(monDecimalPoint);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7892
	__AT_PUT_(info, @symbol(monetaryDecimalPoint), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7893
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7894
    if (monThousandsSep) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7895
	val = __MKSTRING(monThousandsSep);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7896
	__AT_PUT_(info, @symbol(monetaryThousandsSeparator), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7897
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7898
    if (positiveSign) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7899
	val = __MKSTRING(positiveSign);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7900
	__AT_PUT_(info, @symbol(positiveSign), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7901
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7902
    if (negativeSign) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7903
	val = __MKSTRING(negativeSign);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7904
	__AT_PUT_(info, @symbol(negativeSign), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7905
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7906
    if (intFractDigits >= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7907
	__AT_PUT_(info, @symbol(internationalFractionalDigits),  __mkSmallInteger(intFractDigits));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7908
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7909
    if (fractDigits >= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7910
	__AT_PUT_(info, @symbol(fractionalDigits),  __mkSmallInteger(fractDigits));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7911
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7912
    if (csPosPrecedes >= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7913
	if (csPosPrecedes == 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7914
	    val = false;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7915
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7916
	    val = true;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7917
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7918
	__AT_PUT_(info, @symbol(positiveSignPrecedesCurrencySymbol), val );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7919
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7920
    if (csNegPrecedes >= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7921
	if (csNegPrecedes == 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7922
	    val = false;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7923
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7924
	    val = true;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7925
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7926
	__AT_PUT_(info, @symbol(negativeSignPrecedesCurrencySymbol), val );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7927
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7928
    if (csPosSepBySpace >= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7929
	if (csPosSepBySpace == 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7930
	    val = false;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7931
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7932
	    val = true;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7933
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7934
	__AT_PUT_(info, @symbol(positiveSignSeparatedBySpaceFromCurrencySymbol), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7935
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7936
    if (csNegSepBySpace >= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7937
	if (csNegSepBySpace == 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7938
	    val = false;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7939
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7940
	    val = true;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7941
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7942
	__AT_PUT_(info, @symbol(negativeSignSeparatedBySpaceFromCurrencySymbol), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7943
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7944
    switch (csPosSignPosition) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7945
	case 0:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7946
	    val = @symbol(parenthesesAround);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7947
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7948
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7949
	case 1:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7950
	    val = @symbol(signPrecedes);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7951
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7952
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7953
	case 2:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7954
	    val = @symbol(signSuceeds);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7955
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7956
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7957
	case 3:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7958
	    val = @symbol(signPrecedesCurrencySymbol);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7959
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7960
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7961
	case 4:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7962
	    val = @symbol(signSuceedsCurrencySymbol);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7963
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7964
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7965
	default:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7966
	    val = nil;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7967
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7968
    if (val != nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7969
	__AT_PUT_(info, @symbol(positiveSignPosition), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7970
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7971
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7972
    switch (csNegSignPosition) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7973
	case 0:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7974
	    val = @symbol(parenthesesAround);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7975
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7976
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7977
	case 1:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7978
	    val = @symbol(signPrecedes);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7979
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7980
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7981
	case 2:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7982
	    val = @symbol(signSuceeds);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7983
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7984
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7985
	case 3:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7986
	    val = @symbol(signPrecedesCurrencySymbol);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7987
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7988
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7989
	case 4:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7990
	    val = @symbol(signSuceedsCurrencySymbol);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7991
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7992
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7993
	default:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7994
	    val = nil;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7995
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7996
    if (val != nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  7997
	__AT_PUT_(info, @symbol(negativeSignPosition), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7998
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7999
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8000
    ^ info
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8001
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8002
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8003
     OperatingSystem getLocaleInfo
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8004
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8005
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8006
    "Created: 23.12.1995 / 14:19:20 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8007
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8008
15506
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8009
getNetworkAddresses
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8010
    "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
  8011
	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
  8012
	value -> the network adsress (as SocketAddress)
15506
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8013
     for each interface
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8014
    "
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8015
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8016
    |info nAdapters rawData entry
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8017
     name description macAddress ipAddress ipAddressMask|
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8018
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8019
    rawData := Array new:50.
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8020
%{
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8021
/*
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8022
 * temporary undef String to avoid a #define-conflict
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8023
 * between ST/X's String and Windows String typedef
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8024
 */
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8025
# undef String
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8026
# undef Context
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8027
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8028
    IP_ADAPTER_INFO AdapterInfo[32];
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8029
    DWORD dwBufLen = sizeof(AdapterInfo);
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8030
    DWORD dwStatus;
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8031
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8032
    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
  8033
			    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
  8034
			    &dwBufLen);                  // [in] size of receive data buffer
15506
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8035
    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
  8036
	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
  8037
	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
  8038
	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
  8039
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8040
	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
  8041
	do {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8042
	    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
  8043
	    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
  8044
	    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
  8045
	    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
  8046
	    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
  8047
	    entry = __ARRAY_NEW_INT(5);
15506
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8048
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8049
/*
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8050
 * back to ST/X's String definition
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8051
 */
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8052
# ifdef __DEF_String
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8053
#  define String __DEF_String
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8054
# endif
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8055
# ifdef __DEF_String
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8056
#  define Context __DEF_Context
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8057
# endif
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8058
	    __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
  8059
	    __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
  8060
	    __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
  8061
	    __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
  8062
	    __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
  8063
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8064
	    __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
  8065
	    nA++;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8066
	    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
  8067
	} while(pAdapterInfo);
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8068
	nAdapters = __mkSmallInteger(nA);
15506
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8069
    }
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8070
%}.
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8071
    "Keep the order as returned by the OS"
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8072
    info := OrderedDictionary new:nAdapters.
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8073
    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
  8074
	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
  8075
	    |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
  8076
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8077
	    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
  8078
	    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
  8079
	    "/ 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
  8080
	    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
  8081
	    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
  8082
	    "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
  8083
	    (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
  8084
		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
  8085
	    ]
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8086
	].
15506
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8087
    ].
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8088
    ^ info
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8089
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8090
    "
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8091
     OperatingSystem getNetworkAddresses
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8092
    "
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8093
!
f54a4e5da9ce class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15500
diff changeset
  8094
7287
b10efc6c9407 Fix spelling (getNetworkMACAddresses)
Stefan Vogel <sv@exept.de>
parents: 7199
diff changeset
  8095
getNetworkMACAddresses
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8096
    "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
  8097
	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
  8098
	value -> the MAC adress (as ByteArray)
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8099
     for each interface
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8100
    "
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8101
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8102
    |info nAdapters rawData entry
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8103
     name description macAddress ipAddress ipAddressMask|
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8104
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8105
    rawData := Array new:50.
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8106
%{
8319
2d179dc8dc3f Fix #getNetworkMACAdress for XP/2k
Claus Gittinger <cg@exept.de>
parents: 8270
diff changeset
  8107
/*
2d179dc8dc3f Fix #getNetworkMACAdress for XP/2k
Claus Gittinger <cg@exept.de>
parents: 8270
diff changeset
  8108
 * temporary undef String to avoid a #define-conflict
2d179dc8dc3f Fix #getNetworkMACAdress for XP/2k
Claus Gittinger <cg@exept.de>
parents: 8270
diff changeset
  8109
 * between ST/X's String and Windows String typedef
2d179dc8dc3f Fix #getNetworkMACAdress for XP/2k
Claus Gittinger <cg@exept.de>
parents: 8270
diff changeset
  8110
 */
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8111
# undef String
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8112
# undef Context
8319
2d179dc8dc3f Fix #getNetworkMACAdress for XP/2k
Claus Gittinger <cg@exept.de>
parents: 8270
diff changeset
  8113
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8114
    IP_ADAPTER_INFO AdapterInfo[32];
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8115
    DWORD dwBufLen = sizeof(AdapterInfo);
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8116
    DWORD dwStatus;
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  8117
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  8118
    dwStatus = GetAdaptersInfo(
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8119
			    AdapterInfo,                 // [out] buffer to receive data
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8120
			    &dwBufLen);                  // [in] size of receive data buffer
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  8121
    if (dwStatus == ERROR_SUCCESS) {
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8122
	PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8123
	unsigned char *bP;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8124
	int nA = 0;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8125
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8126
	bP = __byteArrayVal(rawData);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8127
	do {
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8128
	    name = __MKSTRING(pAdapterInfo->AdapterName);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8129
	    description = __MKSTRING(pAdapterInfo->Description);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8130
	    macAddress = __MKBYTEARRAY(pAdapterInfo->Address, 6);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8131
	    ipAddress = __MKSTRING(pAdapterInfo->IpAddressList.IpAddress.String);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8132
	    ipAddressMask = __MKSTRING(pAdapterInfo->IpAddressList.IpMask.String);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8133
	    entry = __ARRAY_NEW_INT(5);
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
  8134
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8135
/*
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8136
 * back to ST/X's String definition
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8137
 */
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8138
# ifdef __DEF_String
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8139
#  define String __DEF_String
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8140
# endif
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8141
# ifdef __DEF_String
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8142
#  define Context __DEF_Context
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  8143
# endif
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8144
	    __ArrayInstPtr(entry)->a_element[0] = name; __STORE(entry, name);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8145
	    __ArrayInstPtr(entry)->a_element[1] = description; __STORE(entry, description);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8146
	    __ArrayInstPtr(entry)->a_element[2] = macAddress; __STORE(entry, macAddress);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8147
	    __ArrayInstPtr(entry)->a_element[3] = ipAddress; __STORE(entry, ipAddress);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8148
	    __ArrayInstPtr(entry)->a_element[4] = ipAddressMask; __STORE(entry, ipAddressMask);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8149
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8150
	    __ArrayInstPtr(rawData)->a_element[nA] = entry; __STORE(rawData, entry);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8151
	    nA++;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8152
	    pAdapterInfo = pAdapterInfo->Next;
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8153
	} while(pAdapterInfo);
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
  8154
	nAdapters = __mkSmallInteger(nA);
15169
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  8155
    }
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  8156
%}.
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  8157
    "Keep the order as reurned by the OS"
0cf7770d6e58 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15076
diff changeset
  8158
    info := OrderedDictionary new:nAdapters.
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  8159
    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
  8160
	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
  8161
	    |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
  8162
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
  8163
	    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
  8164
	    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
  8165
	    "/ 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
  8166
	    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
  8167
	    "/ 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
  8168
	    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
  8169
	].
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8170
    ].
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8171
    ^ info
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8172
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8173
    "
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8174
     OperatingSystem getNetworkMACAddresses
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8175
    "
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8176
!
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  8177
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8178
getNumberOfProcessors
12649
7d8aad540a9b changed comment: #getNumberOfProcessors
Stefan Vogel <sv@exept.de>
parents: 12638
diff changeset
  8179
    "answer the number of physical processors in the system"
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8180
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8181
    %{
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8182
	SYSTEM_INFO sInfo;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8183
	GetSystemInfo(&sInfo);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8184
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8185
	return __mkSmallInteger(sInfo.dwNumberOfProcessors);
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8186
    %}.
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8187
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8188
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8189
	self getNumberOfProcessors
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8190
    "
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8191
!
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
  8192
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8193
getProcessId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8194
    "return the (unix-)processId"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8195
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8196
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8197
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8198
    int pid = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8199
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8200
    pid = GetCurrentProcessId() & 0x3FFFFFFF;
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  8201
    RETURN ( __mkSmallInteger(pid) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8202
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8203
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8204
     OperatingSystem getProcessId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8205
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8206
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8207
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8208
getSystemID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8209
    "if supported by the OS, return the systemID;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8210
     a unique per machine identification.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8211
     WARNING:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8212
	not all systems support this; on some, 'unknown' is returned."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8213
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8214
%{  /* NO_CONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8215
#if defined(HAS_GETHOSTID)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8216
    int runningId;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8217
    OBJ arr;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8218
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8219
    runningId = gethostid();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8220
    arr = __BYTEARRAY_UNINITIALIZED_NEW_INT(4);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8221
    *(int *)(__ByteArrayInstPtr(arr)->ba_element) = runningId;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8222
    RETURN (arr);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8223
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8224
#if defined(HAS_SYSINFO) && defined(SI_HW_SERIAL)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8225
    {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8226
	char buffer[128];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8227
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8228
	buffer[0] = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8229
	if (sysinfo(SI_HW_SERIAL, buffer, sizeof(buffer))) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8230
	    buffer[127] = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8231
	    if (strlen(buffer) > 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8232
		RETURN(__MKSTRING(buffer));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8233
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8234
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8235
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8236
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8237
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8238
    ^ 'unknown'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8239
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8240
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8241
     OperatingSystem getSystemID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8242
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8243
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8244
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8245
getSystemInfo
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8246
    "return info on the system weare running on.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8247
     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
  8248
     otherwise, some simulated info is returned.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8249
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8250
     WARNING:
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8251
       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
  8252
       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
  8253
       OS, for example, linux returns 'ix86', while WIN32 returns 'x86'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8254
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8255
       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
  8256
       information.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8257
       (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
  8258
	may be based upon this info).
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8259
       Your application should NOT depend upon this in any way.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8260
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8261
     The returned info may (or may not) contain:
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8262
	#system -> some operating system identification (irix, Linux, nt, win32s ...)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8263
	#version -> OS version (some os version identification)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8264
	#release -> OS release (3.5, 1.2.1 ...)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8265
	#node   -> some host identification (hostname)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8266
	#domain  -> domain name (hosts domain)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8267
	#machine -> type of machine (i586, mips ...)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8268
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8269
     win32:
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8270
	#physicalRam -> total amount of physical memory
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8271
	#freeRam -> amount of free memory
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8272
	#swapSize -> size of swapSpace (page file)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8273
	#freeSwap -> free bytes in swapSpace
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8274
	#virtualRam -> total amount of virtual memory
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8275
	#freeVirtual -> amount of free virtual memory
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8276
	#memoryLoad -> percentage of memory usage (useless)
10746
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8277
    "
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8278
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8279
    |sys node rel ver minorVer majorVer mach dom info arch
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8280
     physicalRam freeRam swapSize freeSwap
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  8281
     virtualRam freeVirtual memoryLoad numberOfCPUs|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8282
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8283
%{  /* STACK: 4096 */
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
    char vsnBuffer[32];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8286
    char *s;
6740
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  8287
    int winVer, verMinor, verMajor;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8288
    DWORD vsn;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8289
    SYSTEM_INFO sysInfo;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8290
    MEMORYSTATUS memStatus;
8416
77f3289fc2c7 Use snprintf for security (paranoia)
Stefan Vogel <sv@exept.de>
parents: 8412
diff changeset
  8291
    int len;
5133
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
    vsn = GetVersion();
6740
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  8294
    winVer = LOWORD(vsn);
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  8295
    verMinor = HIBYTE(winVer);
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  8296
    verMajor = LOBYTE(winVer);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8297
10746
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8298
    minorVer = __mkSmallInteger(verMinor);
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8299
    majorVer = __mkSmallInteger(verMajor);
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8300
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8301
    if (HIWORD(vsn) & 0x8000) {
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8302
	sys = @symbol(win95);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8303
    } else {
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8304
	if ((verMajor > 5)
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8305
	 || ((verMajor == 5) && (verMinor >= 1))) {
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8306
	    sys = @symbol(xp);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8307
	    if (verMajor >= 6) {
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8308
		sys = @symbol(vista);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8309
		if (verMinor >= 1) {
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8310
		    sys = @symbol(win7);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8311
		    if (verMinor >= 2) {
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8312
			sys = @symbol(win8);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8313
		    }
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8314
		}
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8315
	    }
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8316
	} else {
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8317
	    sys = @symbol(nt);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8318
	}
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8319
    }
8416
77f3289fc2c7 Use snprintf for security (paranoia)
Stefan Vogel <sv@exept.de>
parents: 8412
diff changeset
  8320
    len = snprintf(vsnBuffer, sizeof(vsnBuffer), "%d.%d", verMajor, verMinor);
77f3289fc2c7 Use snprintf for security (paranoia)
Stefan Vogel <sv@exept.de>
parents: 8412
diff changeset
  8321
    rel = __MKSTRING_L(vsnBuffer, len);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8322
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8323
    GetSystemInfo(&sysInfo);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8324
    memStatus.dwLength = sizeof(memStatus);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8325
    GlobalMemoryStatus(&memStatus);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8326
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8327
    memoryLoad = __MKUINT(memStatus.dwMemoryLoad);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8328
    physicalRam = __MKUINT(memStatus.dwTotalPhys);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8329
    freeRam = __MKUINT(memStatus.dwAvailPhys);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8330
    swapSize = __MKUINT(memStatus.dwTotalPageFile);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8331
    freeSwap = __MKUINT(memStatus.dwAvailPageFile);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8332
    virtualRam = __MKUINT(memStatus.dwTotalVirtual);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8333
    freeVirtual = __MKUINT(memStatus.dwAvailVirtual);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8334
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8335
#if defined(__BORLANDC__) && (__BORLANDC__ <= 1339)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8336
    /* BorlandC3 ... */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8337
    switch (sysInfo.u.s.wProcessorArchitecture)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8338
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8339
    /* MSC, BorlandC4 ... */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8340
    switch (sysInfo.wProcessorArchitecture)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8341
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8342
    {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8343
#ifdef PROCESSOR_ARCHITECTURE_INTEL
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8344
	case PROCESSOR_ARCHITECTURE_INTEL:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8345
	    arch = @symbol(intel);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8346
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8347
#endif
13534
a788fd375ed1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
  8348
#ifdef PROCESSOR_ARCHITECTURE_AMD64
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8349
	case PROCESSOR_ARCHITECTURE_AMD64:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8350
	    arch = @symbol(x64);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8351
	    break;
13534
a788fd375ed1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13533
diff changeset
  8352
#endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8353
#ifdef PROCESSOR_ARCHITECTURE_MIPS
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8354
	case PROCESSOR_ARCHITECTURE_MIPS:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8355
	    arch = @symbol(mips);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8356
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8357
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8358
#ifdef PROCESSOR_ARCHITECTURE_ALPHA
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8359
	case PROCESSOR_ARCHITECTURE_ALPHA:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8360
	    arch = @symbol(alpha);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8361
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8362
#endif
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8363
#ifdef PROCESSOR_ARCHITECTURE_ALPHA64
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8364
	case PROCESSOR_ARCHITECTURE_ALPHA64:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8365
	    arch = @symbol(alpha64);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8366
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8367
#endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8368
#ifdef PROCESSOR_ARCHITECTURE_PPC
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8369
	case PROCESSOR_ARCHITECTURE_PPC:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8370
	    arch = @symbol(ppc);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8371
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8372
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8373
#ifdef PROCESSOR_ARCHITECTURE_ARM
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8374
	case PROCESSOR_ARCHITECTURE_ARM:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8375
	    arch = @symbol(arm);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8376
	    break;
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  8377
#endif
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8378
#ifdef PROCESSOR_ARCHITECTURE_SHX
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8379
	case PROCESSOR_ARCHITECTURE_SHX:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8380
	    arch = @symbol(shx);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8381
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8382
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8383
#ifdef PROCESSOR_ARCHITECTURE_IA64
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8384
	case PROCESSOR_ARCHITECTURE_IA64:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8385
	    arch = @symbol(ia64);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8386
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8387
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8388
#ifdef PROCESSOR_ARCHITECTURE_MSIL
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8389
	case PROCESSOR_ARCHITECTURE_MSIL:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8390
	    arch = @symbol(msil);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8391
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8392
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8393
#ifdef PROCESSOR_ARCHITECTURE_IA32_ON_WIN64
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8394
	case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8395
	    arch = @symbol(ia32_on_win64);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8396
	    break;
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8397
#endif
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8398
	default:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8399
	    arch = @symbol(unknown);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8400
	    break;
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8401
    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8402
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8403
    switch (sysInfo.dwProcessorType) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8404
#ifdef PROCESSOR_INTEL_386
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8405
	case PROCESSOR_INTEL_386:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8406
	    mach = @symbol(i386);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8407
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8408
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8409
#ifdef PROCESSOR_INTEL_486
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8410
	case PROCESSOR_INTEL_486:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8411
	    mach = @symbol(i486);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8412
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8413
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8414
#ifdef PROCESSOR_INTEL_PENTIUM
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8415
	case PROCESSOR_INTEL_PENTIUM:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8416
	    mach = @symbol(i586);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8417
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8418
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8419
#ifdef PROCESSOR_INTEL_860
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8420
	case PROCESSOR_INTEL_860:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8421
	    mach = @symbol(i860);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8422
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8423
#endif
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8424
#ifdef PROCESSOR_INTEL_IA64
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8425
	case PROCESSOR_INTEL_IA64:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8426
	    mach = @symbol(ia64);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8427
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8428
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8429
#ifdef PROCESSOR_AMD_X8664
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8430
	case PROCESSOR_AMD_X8664:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8431
	    mach = @symbol(x86_64);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8432
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8433
#endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8434
#ifdef PROCESSOR_MIPS_R2000
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8435
	case PROCESSOR_MIPS_R2000:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8436
	    mach = @symbol(r2000);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8437
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8438
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8439
#ifdef PROCESSOR_MIPS_R3000
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8440
	case PROCESSOR_MIPS_R3000:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8441
	    mach = @symbol(r3000);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8442
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8443
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8444
#ifdef PROCESSOR_MIPS_R4000
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8445
	case PROCESSOR_MIPS_R4000:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8446
	    mach = @symbol(r4000);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8447
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8448
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8449
#ifdef PROCESSOR_ALPHA_21064
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8450
	case PROCESSOR_ALPHA_21064:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8451
	    mach = @symbol(alpha21064);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8452
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8453
#endif
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8454
#ifdef PROCESSOR_ARM720
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8455
	case PROCESSOR_ARM720:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8456
	    mach = @symbol(arm720);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8457
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8458
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8459
#ifdef PROCESSOR_ARM820
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8460
	case PROCESSOR_ARM820:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8461
	    mach = @symbol(arm820);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8462
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8463
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8464
#ifdef PROCESSOR_ARM920
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8465
	case PROCESSOR_ARM920:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8466
	    mach = @symbol(arm920);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8467
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8468
#endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8469
#ifdef PROCESSOR_ARM_7TDMI
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8470
	case PROCESSOR_ARM_7TDMI:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8471
	    mach = @symbol(arm70001);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8472
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8473
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8474
#ifdef PROCESSOR_STRONGARM
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8475
	case PROCESSOR_STRONGARM:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8476
	    mach = @symbol(strongarm);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8477
	    break;
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  8478
#endif
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8479
#ifdef PROCESSOR_PPC_601
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8480
	case PROCESSOR_PPC_601:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8481
	    mach = @symbol(ppc601);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8482
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8483
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8484
#ifdef PROCESSOR_PPC_603
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8485
	case PROCESSOR_PPC_603:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8486
	    mach = @symbol(ppc603);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8487
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8488
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8489
#ifdef PROCESSOR_PPC_604
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8490
	case PROCESSOR_PPC_604:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8491
	    mach = @symbol(ppc604);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8492
	    break;
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8493
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  8494
#ifdef PROCESSOR_PPC_620
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8495
	case PROCESSOR_PPC_620:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8496
	    mach = @symbol(ppc620);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8497
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8498
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8499
#ifdef PROCESSOR_HITACHI_SH3
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8500
	case PROCESSOR_HITACHI_SH3:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8501
	    mach = @symbol(sh3);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8502
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8503
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8504
#ifdef PROCESSOR_HITACHI_SH3E
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8505
	case PROCESSOR_HITACHI_SH3E:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8506
	    mach = @symbol(sh3e);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8507
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8508
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8509
#ifdef PROCESSOR_HITACHI_SH4
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8510
	case PROCESSOR_HITACHI_SH4:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8511
	    mach = @symbol(sh4);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8512
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8513
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8514
#ifdef PROCESSOR_MOTOROLA_821
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8515
	case PROCESSOR_MOTOROLA_821:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8516
	    mach = @symbol(mc821);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8517
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8518
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8519
#ifdef PROCESSOR_SHx_SH3
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8520
	case PROCESSOR_SHx_SH3:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8521
	    mach = @symbol(shx_sh3);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8522
	    break;
14746
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8523
#endif
c7cb8262eb49 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14740
diff changeset
  8524
#ifdef PROCESSOR_SHx_SH4
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8525
	case PROCESSOR_SHx_SH4:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8526
	    mach = @symbol(shx_sh4);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8527
	    break;
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8528
#endif
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8529
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8530
	default:
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8531
	    sprintf(vsnBuffer, "%d", sysInfo.dwProcessorType);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8532
	    mach =  __MKSTRING(vsnBuffer);
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8533
	    break;
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8534
    }
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  8535
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  8536
    numberOfCPUs = __MKUINT(sysInfo.dwNumberOfProcessors);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8537
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8538
    node isNil ifTrue:[
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8539
	node := self getHostName.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8540
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8541
    dom isNil ifTrue:[
14782
31a237b7cfda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14756
diff changeset
  8542
	dom := self getDomainName.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8543
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8544
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8545
    info := IdentityDictionary new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8546
    info at:#system put:sys.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8547
    info at:#node put:node.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8548
    rel notNil ifTrue:[info at:#release put:rel].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8549
    ver notNil ifTrue:[info at:#version put:ver].
10746
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8550
    majorVer notNil ifTrue:[info at:#majorVersion put:majorVer].
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8551
    minorVer notNil ifTrue:[info at:#minorVersion put:minorVer].
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  8552
    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
  8553
    arch notNil ifTrue:[info at:#architecture put:arch].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8554
    dom notNil ifTrue:[info at:#domain put:dom].
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  8555
    numberOfCPUs notNil ifTrue:[info at:#numberOfCPUs put:numberOfCPUs].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8556
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8557
    info at:#memoryLoad put:memoryLoad.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8558
    info at:#physicalRam put:physicalRam.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8559
    info at:#freeRam put:freeRam.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8560
    info at:#swapSize put:swapSize.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8561
    info at:#freeSwap put:freeSwap.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8562
    info at:#virtualRam put:virtualRam.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8563
    info at:#freeVirtual put:freeVirtual.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8564
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8565
    info at:#osType put:(self getOSType).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8566
    ^ info
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8567
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8568
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8569
     OperatingSystem getSystemInfo
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8570
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8571
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8572
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8573
getSystemType
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8574
    "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
  8575
     This is almost the same as getOSType, but the returned string
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8576
     is slightly different for some systems (i.e. iris vs. irix).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8577
     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
  8578
     here ...
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8579
     (except for slight differences between next/mach and other machs)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8580
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8581
    ^ #win32
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8582
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8583
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8584
     OperatingSystem getSystemType
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8585
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8586
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8587
12837
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  8588
getThreadId
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  8589
    "return the (windows-) threadId"
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  8590
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  8591
%{  /* NOCONTEXT */
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  8592
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  8593
    int pid = 0;
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  8594
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  8595
    pid = GetCurrentThreadId() & 0x3FFFFFFF;
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  8596
    RETURN ( __mkSmallInteger(pid) );
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  8597
%}
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  8598
    "
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  8599
     OperatingSystem getThreadId
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  8600
    "
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  8601
!
6bc60c34c98d added: #getThreadId
Claus Gittinger <cg@exept.de>
parents: 12828
diff changeset
  8602
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8603
getWindowsDirectory
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8604
    "internal interface - only for Windows based systems.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8605
     Return the windows directory
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8606
     (which - depending on the system - may be \WINNT, \WINDOWS or whatever)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8607
     On non-windows systems, nil is returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8608
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8609
%{
13780
2f055d86569e visual c compilability
Claus Gittinger <cg@exept.de>
parents: 13778
diff changeset
  8610
    char buffer[MAXPATHLEN+1];
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8611
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8612
    if (GetWindowsDirectory(buffer, MAXPATHLEN)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8613
	RETURN (__MKSTRING(buffer));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8614
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8615
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8616
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8617
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8618
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8619
     OperatingSystem getWindowsDirectory
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8620
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8621
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8622
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8623
getWindowsSystemDirectory
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8624
    "internal interface - only for Windows based systems.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8625
     Return the windows system directory
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8626
     (which - depending on the system - may be \WINNT\SYSTEM32,
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8627
      \WINDOWS\SYSTEM or whatever)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8628
     On non-windows systems, nil is returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8629
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8630
%{
13780
2f055d86569e visual c compilability
Claus Gittinger <cg@exept.de>
parents: 13778
diff changeset
  8631
    char buffer[MAXPATHLEN+1];
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8632
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8633
    if (GetSystemDirectory(buffer, MAXPATHLEN)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8634
	RETURN (__MKSTRING(buffer));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8635
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8636
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8637
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8638
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8639
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8640
     OperatingSystem getWindowsSystemDirectory
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8641
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8642
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8643
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8644
hasConsole
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8645
    "return true, if there is some kind of console available
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8646
     (i.e. for proper stdIn, stdOut and stdErr handling).
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
  8647
     This only returns false when running únder windows, and
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8648
     the system is running as a pure windows application.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8649
     If false, the miniDebugger is useless and not used."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8650
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8651
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8652
    extern int __getNoConsoleFlag();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8653
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8654
    RETURN ( __getNoConsoleFlag() ? false : true);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8655
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8656
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8657
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8658
isMSDOSlike
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8659
    "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
  8660
     (in contrast to unix-like or vms-like).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8661
     This returns true for any of msdos, win32s, win95,
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8662
     winNT, winXP, Vista, Win7, win8 and os/2."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8663
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8664
    ^ true
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8665
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8666
    "Modified (comment): / 27-10-2012 / 14:00:52 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8667
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8668
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8669
isMSWINDOWSNTlike
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8670
    "This returns true if running in a Windows-NT system."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8671
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8672
%{   /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8673
     if (__isWinNT)
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8674
	RETURN(true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8675
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8676
     ^ false.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8677
!
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
isMSWINDOWSlike
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8680
    "return true, if running on a MS-Windows like system.
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8681
     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
  8682
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8683
    ^ true
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8684
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8685
    "Modified (comment): / 27-10-2012 / 14:01:30 / cg"
5133
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
13315
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  8688
isProcessIdPresent:processHandleOrPid
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  8689
    "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
  8690
     Raise an error, if an exception occures"
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  8691
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  8692
    |error|
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  8693
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  8694
%{
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  8695
    HANDLE processHandle;
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  8696
    int err;
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  8697
13315
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  8698
    if (__isExternalAddressLike(processHandleOrPid) ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8699
	DWORD exitCode;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8700
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8701
	processHandle = _HANDLEVal(processHandleOrPid);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8702
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8703
	if (processHandle == 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8704
	    error = @symbol(invalidParameter);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8705
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8706
	    /* check if the handle still refers to a running process */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8707
	    if (GetExitCodeProcess(processHandle, &exitCode) != 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8708
		if (exitCode == STILL_ACTIVE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8709
		    RETURN(true);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8710
		} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8711
		    RETURN(false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8712
		}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8713
	    } else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8714
		goto checkError;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8715
	    }
13315
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  8716
       }
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  8717
    } else if( __isSmallInteger(processHandleOrPid) ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8718
	// assume, that synchronize needs less privilege...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8719
	processHandle = OpenProcess(SYNCHRONIZE, FALSE, __smallIntegerVal(processHandleOrPid));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8720
	if (processHandle) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8721
	    CloseHandle(processHandle);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8722
	    RETURN(true);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8723
	}
13315
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  8724
a3c7e11d325d comment/format in:
Stefan Vogel <sv@exept.de>
parents: 13284
diff changeset
  8725
checkError:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8726
	err = GetLastError();
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8727
	// we do not have access to the process (so pid does exist ;-))
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8728
	if (err == ERROR_ACCESS_DENIED) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8729
	    RETURN(true);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8730
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8731
	// pid does not exist
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8732
	if (err == ERROR_INVALID_PARAMETER) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8733
	    RETURN(false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8734
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8735
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8736
	// any other error - raise signal
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8737
	__threadErrno = __WIN32_ERR(err);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8738
	error = __mkSmallInteger(__threadErrno);
12638
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  8739
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8740
	error = @symbol(invalidParameter);
12638
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  8741
    }
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  8742
%}.
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  8743
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  8744
    self primitiveFailed:error.
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  8745
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  8746
    "
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  8747
      self isProcessIdPresent:(self getProcessId)
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  8748
      self isProcessIdPresent:4711
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  8749
      self isProcessIdPresent:512
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  8750
      self isProcessIdPresent:'abc'
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  8751
    "
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  8752
!
Stefan Vogel <sv@exept.de>
parents: 12632
diff changeset
  8753
10746
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8754
isVistaLike
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8755
    "return true, if running on a Vista (or newer) like system.
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8756
     (also true for server 2008)"
10746
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8757
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8758
    ^ (self getSystemInfo at:#majorVersion) >= 6
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8759
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8760
    "
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8761
     self isVistaLike
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8762
    "
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8763
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8764
    "Modified (comment): / 27-10-2012 / 13:59:53 / cg"
10746
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8765
!
6a8bf3c28a7d +isVistaLike
Claus Gittinger <cg@exept.de>
parents: 10741
diff changeset
  8766
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8767
isWin7Like
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8768
    "return true, if running on a Windows7 (or newer) like system."
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8769
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8770
    |sysInfo major|
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8771
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8772
    sysInfo := self getSystemInfo.
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8773
    major := sysInfo at:#majorVersion.
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8774
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8775
    ^ (major == 6 and:[(sysInfo at:#minorVersion) >= 1])
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8776
      or:[major > 6]
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8777
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8778
    "
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8779
     self isWin7Like
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8780
    "
14444
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8781
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8782
    "Modified (comment): / 27-10-2012 / 13:59:14 / cg"
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8783
!
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8784
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8785
isWin8Like
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8786
    "return true, if running on a Windows8 (or newer) like system.
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8787
     (also true for server 2012)"
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8788
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8789
    |sysInfo major|
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8790
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8791
    sysInfo := self getSystemInfo.
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8792
    major := sysInfo at:#majorVersion.
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8793
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8794
    ^ (major == 6 and:[(sysInfo at:#minorVersion) >= 2])
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8795
      or:[major > 6]
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8796
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8797
    "
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8798
     self isWin8Like
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8799
    "
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8800
a883e08d2399 added: #isWin8Like
Claus Gittinger <cg@exept.de>
parents: 14364
diff changeset
  8801
    "Created: / 27-10-2012 / 13:59:03 / cg"
12961
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8802
!
f476234e681d added: #isWin7Like
Stefan Vogel <sv@exept.de>
parents: 12934
diff changeset
  8803
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8804
maxFileNameLength
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8805
    "return the max number of characters in a filename.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8806
     CAVEAT:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8807
	 Actually, the following is somewhat wrong - some systems
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8808
	 support different sizes, depending on the volume.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8809
	 We return a somewhat conservative number here.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8810
	 Another entry, to query for volume specific max
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8811
	 will be added in the future."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8812
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8813
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8814
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
     * TODO: newer systems provide a query function for this ... use it
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8817
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8818
     /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8819
      * mhmh - depends on the filesystem type
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8820
      */
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  8821
     RETURN ( __mkSmallInteger(MAXFILELEN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8822
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8823
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8824
     OperatingSystem maxFileNameLength
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8825
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8826
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8827
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8828
maxPathLength
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8829
    "return the max number of characters in a pathName."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8830
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8831
%{  /* NOCONTEXT */
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  8832
    RETURN ( __mkSmallInteger(MAXPATHLEN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8833
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8834
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8835
     OperatingSystem maxPathLength
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8836
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8837
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8838
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  8839
osName
13533
82dc48a9a6ae changed: #osName
Claus Gittinger <cg@exept.de>
parents: 13341
diff changeset
  8840
    |osVersion|
82dc48a9a6ae changed: #osName
Claus Gittinger <cg@exept.de>
parents: 13341
diff changeset
  8841
82dc48a9a6ae changed: #osName
Claus Gittinger <cg@exept.de>
parents: 13341
diff changeset
  8842
    osVersion := OperatingSystem osVersion.
13128
35def02e40f4 CloseHandle added in: getAllProcesses
Michael Beyl <mb@exept.de>
parents: 13114
diff changeset
  8843
    ^ 'Windows ',
13778
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  8844
	(#('2000' 'XP' 'Server2003' 'VISTA' '7' '8')
8e34483d10dd MAXPATHLEN cleanup;
Claus Gittinger <cg@exept.de>
parents: 13742
diff changeset
  8845
	    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
  8846
	    ifAbsent:osVersion).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8847
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8848
    "
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8849
     self osName
13533
82dc48a9a6ae changed: #osName
Claus Gittinger <cg@exept.de>
parents: 13341
diff changeset
  8850
    "
82dc48a9a6ae changed: #osName
Claus Gittinger <cg@exept.de>
parents: 13341
diff changeset
  8851
82dc48a9a6ae changed: #osName
Claus Gittinger <cg@exept.de>
parents: 13341
diff changeset
  8852
    "Modified (comment): / 30-07-2011 / 17:00:50 / cg"
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  8853
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  8854
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  8855
osVersion
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  8856
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  8857
    ^OperatingSystem getSystemInfo at:#release
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  8858
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  8859
    "Created: / 19-01-2007 / 13:15:47 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  8860
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  8861
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8862
pathSeparator
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8863
    "return the character which separates items in the PATH variable"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8864
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8865
    ^ $;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8866
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8867
    "Created: 2.5.1997 / 11:36:47 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8868
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8869
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8870
platformName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8871
    "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
  8872
     This returns #unix for all unix derivatives,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8873
     #os2, #win32, #vms or #mac for the others.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8874
     I.e. it is much less specific than getOSType or getSystemType."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8875
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8876
    ^ #win32
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8877
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8878
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8879
     OperatingSystem platformName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8880
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8881
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8882
    "Modified: 20.6.1997 / 17:37:26 / cg"
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
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  8885
randomBytesInto:bufferOrInteger
12827
c50946e5abe3 comment/format in: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12825
diff changeset
  8886
    "If bufferOrInteger is a String or a ByteArray,
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8887
	fill a given buffer with random bytes from the RtlGenRandom function
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8888
	and nswer the buffer.
12827
c50946e5abe3 comment/format in: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12825
diff changeset
  8889
c50946e5abe3 comment/format in: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12825
diff changeset
  8890
     If bufferOrInteger is a SmallInteger,
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8891
	return this many bytes (max 4) as a SmallInteger.
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  8892
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  8893
     Return nil on error (and raise PrimitiveFailure).
12827
c50946e5abe3 comment/format in: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12825
diff changeset
  8894
c50946e5abe3 comment/format in: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12825
diff changeset
  8895
     NOTE: This is a private interface, please use RandomGenerator!!"
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  8896
12773
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8897
%{
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8898
//    BOOLEAN RtlGenRandom(
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8899
//      __out  PVOID RandomBuffer,
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8900
//      __in   ULONG RandomBufferLength
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8901
//    );
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8902
    static BOOL (__stdcall *P_RtlGenRandom)(PVOID , ULONG) = 0;
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8903
    unsigned char *__buffer;
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8904
    int __bufferSize;
12825
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  8905
    int __useLocalBuffer = 0;
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  8906
    unsigned int __localBuffer = 0;
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  8907
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  8908
    if (__isSmallInteger(bufferOrInteger)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8909
	__useLocalBuffer = 1;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8910
	__buffer = (unsigned char *)&__localBuffer;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8911
	__bufferSize = __smallIntegerVal(bufferOrInteger);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8912
	if (__bufferSize > sizeof(INT))
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8913
	    __bufferSize = sizeof(INT);
12825
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  8914
    } else if (__isString(bufferOrInteger)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8915
	__buffer = __stringVal(bufferOrInteger);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8916
	__bufferSize = __stringSize(bufferOrInteger);
12825
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  8917
    } else if (__isByteArray(bufferOrInteger)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8918
	__buffer = __byteArrayVal(bufferOrInteger);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8919
	__bufferSize = __byteArraySize(bufferOrInteger);
12773
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8920
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8921
	goto error;
12773
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8922
    }
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8923
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8924
    if (P_RtlGenRandom == 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8925
	HINSTANCE hAdvapi32 = LoadLibrary("advapi32.dll");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8926
	// console_printf("hAdvapi32: %x\n", hAdvapi32);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8927
	if (hAdvapi32) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8928
	    P_RtlGenRandom = (BOOL (__stdcall *)(PVOID , ULONG))
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8929
				GetProcAddress(hAdvapi32, "SystemFunction036");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8930
	    // console_printf("P_RtlGenRandom: %x\n", P_RtlGenRandom);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8931
	    if (P_RtlGenRandom == 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8932
		goto error;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8933
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8934
	}
12773
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8935
    }
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8936
    if ((*P_RtlGenRandom)(__buffer, __bufferSize)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8937
	if (__useLocalBuffer) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8938
	    RETURN(__mkSmallInteger(__localBuffer & _MAX_INT));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8939
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8940
	RETURN (bufferOrInteger);
12773
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8941
    }
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8942
error: ;
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8943
%}.
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8944
    self primitiveFailed.
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8945
    ^ nil
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8946
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8947
    "
12825
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  8948
     self randomBytesInto:(ByteArray new:4)
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  8949
     self randomBytesInto:4
5e8dc3aef362 added: #randomBytesInto:
Stefan Vogel <sv@exept.de>
parents: 12821
diff changeset
  8950
     self randomBytesInto:1
12773
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8951
    "
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8952
!
0924f835772c added: #primRtlGenRandomInto:
Claus Gittinger <cg@exept.de>
parents: 12730
diff changeset
  8953
12603
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  8954
setEnvironment:aStringOrSymbol to:newValueString
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  8955
    "set an environment variable"
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  8956
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  8957
%{  /* NOCONTEXT */
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  8958
    char *env;
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  8959
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  8960
    if (__isStringLike(aStringOrSymbol)
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  8961
     && __isStringLike(newValueString) ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8962
	if (SetEnvironmentVariable(__stringVal(aStringOrSymbol), __stringVal(newValueString)) != 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8963
	    RETURN(self);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  8964
	}
12603
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  8965
    }
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  8966
%}.
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  8967
    self primitiveFailed
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  8968
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  8969
    "
12907
1995938e4768 add getAllProcesses and fix terminateProcessGroup:
ca
parents: 12838
diff changeset
  8970
     OperatingSystem getEnvironment:'PATH'
12603
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  8971
     OperatingSystem setEnvironment:'PATH' to:('c:\cygwin\bin;' , (OperatingSystem getEnvironment:'PATH'))
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  8972
    "
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  8973
!
70b6928c6365 added: #setEnvironment:to:
Claus Gittinger <cg@exept.de>
parents: 12489
diff changeset
  8974
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8975
setLocaleInfo:anInfoDictionary
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8976
    "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
  8977
     (internal in ST/X only - the OS's settings remain unaffected)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8978
     See description of fields in #getLocaleInfo.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8979
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8980
     Notice, that (for now), the system does not use this information;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8981
     it should be used by applications as required."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8982
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8983
    LocaleInfo := anInfoDictionary
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8984
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8985
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8986
     |d|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8987
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8988
     d := IdentityDictionary new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8989
     d at:#decimalPoint                 put:'.'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8990
     d at:#thousandsSeparator           put:','         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8991
     d at:#currencySymbol               put:'USD'       .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8992
     d at:#monetaryDecimalPoint         put:'.'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8993
     d at:#monetaryThousandsSeparator   put:'.'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8994
     d at:#fractionalDigits             put:2           .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8995
     d at:#positiveSign                 put:'+'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8996
     d at:#negativeSign                 put:'-'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8997
     d at:#positiveSignPrecedesCurrencySymbol put:true          .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8998
     d at:#negativeSignPrecedesCurrencySymbol put:false         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8999
     OperatingSystem setLocaleInfo:d
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9000
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9001
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9002
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9003
supportsChildInterrupts
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9004
    "return true, if the OS supports childProcess termination signalling
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9005
     through interrupts (i.e. SIGCHILD)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9006
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9007
%{  /* NOCONTEXT */
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9008
#if defined(SIGCHLD) || defined(SIGCLD)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9009
    RETURN (true);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9010
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9011
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9012
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9013
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9014
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9015
     OperatingSystem supportsChildInterrupts
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9016
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9017
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9018
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9019
supportsFileOwnerGroups
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9020
    "return true, if the OS's file system supports file
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9021
     group ownership - all OS's except windows do"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9022
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9023
    ^ false
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
    "Created: / 10.9.1998 / 17:57:03 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9026
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9027
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9028
supportsFileOwners
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9029
    "return true, if the OS's file system supports file
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9030
     ownership - all OS's except windows do"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9031
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9032
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9033
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9034
    "Created: / 10.9.1998 / 17:55:16 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9035
    "Modified: / 10.9.1998 / 17:57:11 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9036
!
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
supportsIOInterrupts
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9039
    "return true, if the OS supports IO availability interrupts
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9040
     (i.e. SIGPOLL/SIGIO).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9041
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9042
     Currently, this mechanism does not work on all
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9043
     systems ...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9044
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9045
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9046
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9047
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9048
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9049
     OperatingSystem supportsIOInterrupts
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9050
    "
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
supportsNonBlockingIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9054
    "return true, if the OS supports nonblocking IO."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9055
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9056
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9057
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9058
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9059
     OperatingSystem supportsNonBlockingIO
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9060
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9061
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9062
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9063
supportsSelect
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9064
    "return true, if the OS supports selecting on multiple
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9065
     filedescriptors via select.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9066
     If false is returned, ProcessorScheduler will poll in 50ms
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9067
     intervals for I/O becoming ready."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9068
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9069
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9070
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9071
# if defined(WIN32S)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9072
    RETURN (false);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9073
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9074
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9075
    ^ true
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9076
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9077
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9078
     OperatingSystem supportsSelect
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9079
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9080
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9081
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9082
supportsSelectOnPipes
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9083
    "return true, if the OS supports selecting on pipe
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9084
     filedescriptors via select.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9085
     If false is returned, ProcessorScheduler will poll in 50ms
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9086
     intervals for I/O becoming ready."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9087
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9088
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9089
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9090
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9091
     OperatingSystem supportsSelectOnPipes
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9094
    "Modified: / 14.12.1999 / 19:41:03 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9095
    "Created: / 14.12.1999 / 19:43:13 / cg"
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9098
supportsSelectOnSockets
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9099
    "return true, if the OS supports selecting on socket
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9100
     filedescriptors via select.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9101
     If false is returned, ProcessorScheduler will poll in 50ms
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9102
     intervals for I/O becoming ready."
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
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9105
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9106
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9107
     OperatingSystem supportsSelectOnSockets
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9108
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9109
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9110
    "Modified: / 14.12.1999 / 19:41:03 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9111
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9112
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9113
supportsVolumes
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9114
    "return true, if the OS supports disk volumes.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9115
     False is returned for UNIX, true for MSDOS and VMS"
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
    ^ true
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9118
! !
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
!Win32OperatingSystem class methodsFor:'path queries'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9121
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9122
defaultPackagePath
5147
305aa6d3926a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  9123
    |pPath pkgDirPath dirs p|
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9124
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9125
    pPath := super defaultPackagePath.
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9126
    pkgDirPath := self stxPackageDirPath.
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9127
    pkgDirPath notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9128
	"/ and also add the packageDirPath from the registry ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9129
	dirs := pkgDirPath asCollectionOfSubstringsSeparatedBy:$;.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9130
	dirs do:[:aDir |
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9131
	    (pPath includes:aDir) ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9132
		pPath add:aDir.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9133
	    ]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9134
	]
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9135
    ] ifFalse:[
13341
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9136
"/        #(
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9137
"/            '\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9138
"/            '\programme\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9139
"/            '\programme\eXept\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9140
"/            '\programs\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9141
"/            '\programs\eXept\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9142
"/        ) do:[:d | |dd|
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9143
"/            dd := d asFilename constructString:'packages'.
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9144
"/            (pPath includes:dd) ifFalse:[
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9145
"/                pPath add:dd.
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9146
"/            ].
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9147
"/            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
  9148
"/            (pPath includes:dd) ifFalse:[
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9149
"/                pPath add:dd.
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9150
"/            ].
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9151
"/        ].
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9152
    ].
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9153
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9154
    "/ under windows, the commandName includes the path - good.
5922
c36b3ecb61f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5918
diff changeset
  9155
    p := Smalltalk commandName.
c36b3ecb61f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5918
diff changeset
  9156
    p notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9157
	p := p asFilename directory constructString:'packages'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9158
	(pPath includes:p) ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9159
	    pPath add:p.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9160
	]
5147
305aa6d3926a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  9161
    ].
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9162
    pPath := pPath select:[:p | p asFilename exists].
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9163
    ^ pPath
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9164
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9165
    "
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9166
     self defaultPackagePath
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9167
    "
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9168
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9169
    "Created: / 24.12.1999 / 00:10:41 / cg"
5147
305aa6d3926a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  9170
    "Modified: / 24.12.1999 / 00:33:26 / cg"
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9171
!
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9172
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9173
defaultSystemPath
9021
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9014
diff changeset
  9174
    |sysPath libDirPath|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9175
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9176
    sysPath := super defaultSystemPath.
9014
f4df89a42724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9013
diff changeset
  9177
5136
faa3c9f42b8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  9178
    libDirPath := self stxLibDirPath.
faa3c9f42b8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  9179
    libDirPath notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9180
	"/ and also add the libDirPath from the registry ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9181
	(sysPath includes:libDirPath) ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9182
	    sysPath add:libDirPath
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9183
	].
9021
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9014
diff changeset
  9184
    ].
13341
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9185
"/    #(
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9186
"/        '\programs\eXept\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9187
"/        '\programme\eXept\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9188
"/        '\programs\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9189
"/        '\programme\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9190
"/        '\smalltalk'
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9191
"/    ) do:[:dir |
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9192
"/        |vsnDir|
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9193
"/
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9194
"/        (dir asFilename isDirectory) ifTrue:[
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9195
"/            vsnDir := dir , '\' , Smalltalk versionString.
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9196
"/            (vsnDir asFilename isDirectory) ifTrue:[
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9197
"/                (sysPath includes:vsnDir) ifFalse:[
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9198
"/                    sysPath add:vsnDir.
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9199
"/                ]
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9200
"/            ].
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9201
"/            (sysPath includes:dir) ifFalse:[
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9202
"/                sysPath add:dir.
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9203
"/            ].
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9204
"/        ]
69f0a940013d SystemPath: no longer. Only leads to trouble.
Claus Gittinger <cg@exept.de>
parents: 13324
diff changeset
  9205
"/    ].
9021
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9014
diff changeset
  9206
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9207
    ^ sysPath
5136
faa3c9f42b8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  9208
5147
305aa6d3926a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  9209
    "Modified: / 24.12.1999 / 00:29:18 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9210
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9211
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9212
stxBinDirPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9213
    "ask the registry for the binary directory"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9214
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9215
    |k p|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9216
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9217
    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
  9218
    k notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9219
	p := k valueNamed:'BinDir'.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9220
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9221
    ^ p
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9222
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9223
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9224
     OperatingSystem stxBinDirPath
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9225
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9226
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9227
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9228
stxLibDirPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9229
    "ask the registry for the lib directory"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9230
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  9231
    (Array
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9232
	with:('HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X\' , Smalltalk versionString)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9233
	with:('HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'))
9021
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9014
diff changeset
  9234
    do:[:eachKeyToTry |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9235
	|k p|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9236
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9237
	k := RegistryEntry key:eachKeyToTry.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9238
	k notNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9239
	    p := k valueNamed:'LibDir'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9240
	    k closeKey.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9241
	    ^ p
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9242
	].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9243
    ].
9021
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9014
diff changeset
  9244
    ^ nil
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9245
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9246
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9247
     OperatingSystem stxLibDirPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9248
    "
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9249
!
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9250
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9251
stxPackageDirPath
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9252
    "ask the registry for the package directory"
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9253
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9254
    |k p|
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9255
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9256
    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
  9257
    k notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9258
	p := k valueNamed:'PackageDirPath'.
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9259
    ].
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9260
    ^ p
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9261
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9262
    "
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9263
     OperatingSystem stxPackageDirPath
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9264
    "
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9265
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  9266
    "Created: / 24.12.1999 / 00:11:12 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9267
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9268
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9269
!Win32OperatingSystem class methodsFor:'printing support'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9270
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9271
abortDoc: deviceContext
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9272
    ^ self primAbortDoc:deviceContext
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9273
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9274
    "Created: / 02-08-2006 / 12:52:12 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9275
    "Modified: / 04-10-2006 / 11:34:37 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9276
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9277
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9278
closePrinter:handle
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9279
    self primClosePrinter:handle
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9280
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9281
    "Created: / 28-07-2006 / 17:55:59 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9282
    "Modified: / 04-10-2006 / 11:34:34 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9283
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9284
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9285
createPrinterDC:driverName device:deviceName output:outputMedium initData:driverData
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9286
    |h|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9287
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9288
    h := self primCreatePrinterDC:driverName device:deviceName output:outputMedium initData:driverData.
10529
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9289
"/    h notNil ifTrue:[
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9290
"/        ^ (Win32Handle newAddress:h address) registerForFinalization
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9291
"/    ].
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9292
    ^ h
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9293
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9294
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9295
     |p hPrinter driverNm mediumNm deviceNm driverData hDC|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9296
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9297
     p := self getPrinters first.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9298
     driverNm := p attributes at:#driverName.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9299
     mediumNm := p attributes at:#medium.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9300
     deviceNm := p printerName.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9301
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9302
     hPrinter := self openPrinter:deviceNm.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9303
     driverData := self getDocumentProperties:nil hPrinter:hPrinter pDeviceName:deviceNm.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9304
     self primClosePrinter:hPrinter.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9305
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9306
     hDC := self createPrinterDC:driverNm device:deviceNm output:mediumNm initData:driverData.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9307
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9308
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9309
    "Created: / 27-07-2006 / 16:22:34 / fm"
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
  9310
    "Modified: / 16-04-2007 / 13:09:16 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9311
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9312
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  9313
deletePrinterDC: hwndArg
10529
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9314
    |return|
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  9315
    return := self primDeletePrinterDC:hwndArg .
10529
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9316
    ^return
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9317
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9318
    "Created: / 27-07-2006 / 16:22:34 / fm"
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9319
!
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9320
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9321
documentPropertiesDialogFor:hwndOrNil hPrinter:hPrinter pDeviceName:deviceName devModeInput:pDevModeInputOrNil
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9322
    |nBytesNeeded hPrinter rslt devModeOutput|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9323
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9324
"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9325
#define DM_UPDATE           1
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9326
#define DM_COPY             2
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9327
#define DM_PROMPT           4
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9328
#define DM_MODIFY           8
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9329
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9330
#define DM_IN_BUFFER        DM_MODIFY
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9331
#define DM_IN_PROMPT        DM_PROMPT
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9332
#define DM_OUT_BUFFER       DM_COPY
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9333
#define DM_OUT_DEFAULT      DM_UPDATE
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9334
"
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9335
    nBytesNeeded := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9336
	   primDocumentProperties:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9337
	   hPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9338
	   pDeviceName: deviceName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9339
	   pDevModeOutput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9340
	   pDevModeInput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9341
	   fMode:0.
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9342
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9343
    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
  9344
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9345
    rslt := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9346
	   primDocumentProperties:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9347
	   hPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9348
	   pDeviceName: deviceName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9349
	   pDevModeOutput:devModeOutput
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9350
	   pDevModeInput:pDevModeInputOrNil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9351
	   fMode:4+2.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9352
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9353
    ^ devModeOutput
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9354
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9355
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9356
     |h|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9357
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9358
     h := self openPrinter:'\\http://exept.exept.de:631\lj4'.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9359
     self documentPropertiesDialogFor:nil hPrinter:h pDeviceName:'\\http://exept.exept.de:631\lj4' devModeInput:nil
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9360
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9361
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9362
    "Created: / 27-07-2006 / 15:39:21 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9363
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9364
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9365
endDoc: deviceContext
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9366
    ^ self primEndDoc:deviceContext
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9367
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9368
    "Created: / 27-07-2006 / 19:46:19 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9369
    "Modified: / 28-07-2006 / 19:23:03 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9370
    "Modified: / 04-10-2006 / 11:35:01 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9371
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9372
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9373
endPage: deviceContext
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9374
    ^ self primEndPage:deviceContext
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9375
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9376
    "Created: / 27-07-2006 / 19:45:28 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9377
    "Modified: / 28-07-2006 / 18:49:40 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9378
    "Modified: / 04-10-2006 / 11:35:06 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9379
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9380
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9381
getDefaultPrinterName
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9382
    "returns the default printer name"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9383
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9384
    ^ (self getProfileString:'windows' key:'device' default:'')
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9385
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9386
    "
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9387
     OperatingSystem getDefaultPrinterName
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9388
    "
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9389
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9390
    "Created: / 02-08-2006 / 17:25:34 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9391
    "Modified: / 04-10-2006 / 11:35:18 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9392
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9393
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  9394
getDeviceCaps:hwndArg index: index
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  9395
    ^ self primGetDeviceCaps:hwndArg index: index
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9396
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9397
    "Created: / 28-07-2006 / 17:45:27 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9398
    "Modified: / 04-10-2006 / 11:35:29 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9399
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9400
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9401
getDocumentProperties:hwndOrNil hPrinter:hPrinter pDeviceName:deviceName
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9402
    |nBytesNeeded rslt devModeOutput|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9403
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9404
"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9405
#define DM_UPDATE           1
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9406
#define DM_COPY             2
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9407
#define DM_PROMPT           4
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9408
#define DM_MODIFY           8
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9409
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9410
#define DM_IN_BUFFER        DM_MODIFY
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9411
#define DM_IN_PROMPT        DM_PROMPT
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9412
#define DM_OUT_BUFFER       DM_COPY
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9413
#define DM_OUT_DEFAULT      DM_UPDATE
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9414
"
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9415
    nBytesNeeded := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9416
	   primDocumentProperties:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9417
	   hPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9418
	   pDeviceName: deviceName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9419
	   pDevModeOutput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9420
	   pDevModeInput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9421
	   fMode:0.
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9422
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9423
    nBytesNeeded < 0 ifTrue:[^nil].
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9424
    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
  9425
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9426
    rslt := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9427
	   primDocumentProperties:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9428
	   hPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9429
	   pDeviceName: deviceName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9430
	   pDevModeOutput:devModeOutput
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9431
	   pDevModeInput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9432
	   fMode:2.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9433
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9434
     ^ devModeOutput
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9435
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9436
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9437
     |h|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9438
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9439
     h := self openPrinter:'\\http://exept.exept.de:631\lj4'.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9440
     self getDocumentProperties:nil hPrinter:h pDeviceName:'\\http://exept.exept.de:631\lj4'
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9441
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9442
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9443
    "Created: / 27-07-2006 / 15:38:03 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9444
    "Modified: / 31-07-2006 / 13:02:02 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9445
    "Modified: / 04-10-2006 / 11:35:39 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9446
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9447
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9448
getPrinterInfo2: printerName
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9449
    |hPrinter rslt informationBuffer bytesNeeded sizeBytesArray|
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9450
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9451
     hPrinter := self openPrinter: printerName .
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9452
     sizeBytesArray := ByteArray new:4.
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
  9453
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9454
     bytesNeeded := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9455
		primGetPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9456
		level:2
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9457
		informationBuffer: nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9458
		bufferSize: 0
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9459
		bufferNeededSize:sizeBytesArray.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9460
     bytesNeeded := sizeBytesArray longAt:1.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9461
     informationBuffer := PrinterInfo2Structure new: bytesNeeded.
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9462
     rslt := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9463
		primGetPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9464
		level:2
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9465
		informationBuffer:informationBuffer
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9466
		bufferSize: bytesNeeded
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9467
		bufferNeededSize:sizeBytesArray.
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9468
     self closePrinter: printerName.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9469
     ^informationBuffer
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9470
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9471
    "
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9472
     OperatingSystem getPrinterInfo2:(OperatingSystem getDefaultPrinterName)
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9473
    "
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9474
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9475
    "Created: / 01-08-2006 / 13:47:19 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9476
    "Modified: / 04-10-2006 / 11:36:41 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9477
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9478
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9479
getPrinters
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9480
    "return a collection of PrinterInfos"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9481
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9482
    |printerNames collectedInfo|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9483
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9484
    printerNames := self getPrintersNames.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9485
    collectedInfo := OrderedCollection new.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9486
    printerNames do:[:eachName |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9487
	|fn vol attributes nm deviceInfo infoFields driverName|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9488
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9489
	attributes := Dictionary new.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9490
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9491
	fn := eachName asFilename.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9492
	vol := fn volume.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9493
	vol notEmptyOrNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9494
	    (vol startsWith:'\\') ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9495
		"/ a remote printer
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9496
		attributes at:#isRemotePrinter put:true.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9497
		attributes at:#remotePrinterName put:(fn baseName).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9498
		attributes at:#remotePrinterHost put:(fn directoryName copyFrom:3).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9499
	    ] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9500
		"/ some other printer
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9501
	    ].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9502
	] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9503
	    "/ some other printer
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9504
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9505
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9506
	deviceInfo := self getProfileString:'PrinterPorts' key:eachName default:''.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9507
	"gives us smething like 'winspool,Ne00:,15,45',
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9508
	 which is: driverName, deviceName, ? , ?"
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9509
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9510
	infoFields := deviceInfo asCollectionOfSubstringsSeparatedBy:$,.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9511
	driverName := infoFields at:1.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9512
	2 to: infoFields size by:3 do:[:i |
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9513
	    |medium longName|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9514
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9515
	    medium := infoFields at:i.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9516
	    longName := eachName ,',' , driverName , ',' , medium.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9517
	    attributes at:#driverName put:driverName.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9518
	    attributes at:#longName put:longName.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9519
	    attributes at:#medium put:medium.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9520
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9521
	    collectedInfo add:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9522
		(AbstractOperatingSystem::PrinterInfo new
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9523
		    printerName:eachName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9524
		    attributes:attributes;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9525
		    setDocumentProperties;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9526
		    yourself)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9527
	].
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9528
    ].
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9529
    ^ collectedInfo
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9530
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9531
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9532
     OperatingSystem getPrinters
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9533
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9534
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9535
    "Created: / 27-07-2006 / 12:18:11 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9536
    "Modified: / 31-07-2006 / 13:06:04 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9537
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9538
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9539
getPrintersNames
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9540
    "return a collection of Printer names"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9541
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9542
    |printerNames|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9543
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9544
    printerNames := (self getProfileString:'PrinterPorts' key:nil default:'')
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9545
		       asCollectionOfSubstringsSeparatedBy:(Character value:0).
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9546
    printerNames := printerNames reject:[:nm | nm isEmpty].
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9547
    ^printerNames
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9548
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9549
    "
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9550
     OperatingSystem getPrintersNames
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9551
    "
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9552
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9553
    "Created: / 27-07-2006 / 17:55:46 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9554
    "Modified: / 04-10-2006 / 11:37:41 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9555
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9556
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9557
getTextExtentPoint: handle string: lpString size: pSize
11085
ff0e28fd7027 changed #primReleaseMutex:
fm
parents: 11084
diff changeset
  9558
ff0e28fd7027 changed #primReleaseMutex:
fm
parents: 11084
diff changeset
  9559
   ^self primGetTextExtentPoint: handle string: lpString count: lpString size size: pSize
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9560
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9561
    "Created: / 03-08-2006 / 11:17:17 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9562
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9563
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9564
getTextMetrics: deviceContext lpMetrics: textMetrics
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9565
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9566
    ^self primGetTextMetrics: deviceContext lpMetrics: textMetrics
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9567
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9568
    "Created: / 02-08-2006 / 16:07:07 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9569
    "Modified: / 04-10-2006 / 11:37:49 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9570
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9571
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9572
openPrinter:name
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9573
    |h hh rslt|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9574
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9575
    hh := ByteArray new:4.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9576
    rslt := self primOpenPrinter:name handleHolder:hh ignored:nil.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9577
    rslt ifFalse:[^ nil].
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9578
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9579
    h := Win32PrinterHandle new setAddressFromBytes:hh.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9580
    h registerForFinalization.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9581
    ^ h
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9582
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9583
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9584
     self openPrinter:'\\http://exept.exept.de:631\lj4'
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9585
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9586
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9587
    "Created: / 27-07-2006 / 14:40:41 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9588
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9589
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  9590
primAbortDoc:hwndArg
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9591
    <apicall: int32 "AbortDoc" (handle) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
  9592
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9593
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9594
    "Created: / 02-08-2006 / 12:52:32 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9595
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9596
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9597
primClosePrinter:handle
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9598
    <apicall: bool "ClosePrinter" ( handle ) module: "winspool.drv" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
  9599
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9600
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9601
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9602
     |h hh rslt|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9603
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9604
     hh := ByteArray new:4.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9605
     rslt := self primOpenPrinter:'\\http://exept.exept.de:631\lj4' handleHolder:hh ignored: nil.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9606
     h := Win32PrinterHandle new setAddressFromBytes:hh.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9607
     self primClosePrinter: h.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9608
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9609
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9610
    "Created: / 27-07-2006 / 14:47:12 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9611
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9612
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9613
primCreatePrinterDC:driverName device:deviceName output:outputMedium initData:driverData
10529
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9614
    <apicall: handle "CreateDCA" ( pointer pointer pointer pointer ) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
  9615
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9616
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9617
    "Modified: / 27-07-2006 / 16:26:25 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9618
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9619
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  9620
primDeletePrinterDC: hwndArg
10529
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9621
    <apicall: bool "DeleteDC" ( handle ) module: "gdi32.dll" >
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9622
    self primitiveFailed.
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9623
!
09bf29a7405a createPrinterDC with normal handle
fm
parents: 10511
diff changeset
  9624
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9625
primDocumentProperties:hwndOrNil hPrinter:hPrinter pDeviceName:deviceName pDevModeOutput:pDevModeOutput pDevModeInput:pDevModeInput fMode:fMode
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9626
    <apicall: int32 "DocumentPropertiesA" ( handle handle lpstr pointer pointer uint32) module: "winspool.drv" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
  9627
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9628
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9629
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9630
     |hPrinter rslt|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9631
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9632
     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
  9633
     rslt := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9634
	    primDocumentProperties:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9635
	    hPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9636
	    pDeviceName: '\\http://exept.exept.de:631\lj4'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9637
	    pDevModeOutput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9638
	    pDevModeInput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9639
	    fMode:0.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9640
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9641
     self halt.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9642
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9643
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9644
    "Created: / 27-07-2006 / 15:02:14 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9645
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9646
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  9647
primEndDoc:hwndArg
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9648
    <apicall: int32 "EndDoc" (handle) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
  9649
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9650
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9651
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9652
     |hPrinter rslt|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9653
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9654
     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
  9655
     rslt := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9656
	    primDocumentProperties:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9657
	    hPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9658
	    pDeviceName: '\\http://exept.exept.de:631\lj4'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9659
	    pDevModeOutput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9660
	    pDevModeInput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9661
	    fMode:0.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9662
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9663
     self halt.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9664
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9665
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9666
    "Created: / 27-07-2006 / 19:31:31 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9667
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9668
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  9669
primEndPage:hwndArg
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9670
    <apicall: int32 "EndPage" (handle) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
  9671
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9672
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9673
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9674
     |hPrinter rslt|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9675
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9676
     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
  9677
     rslt := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9678
	    primDocumentProperties:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9679
	    hPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9680
	    pDeviceName: '\\http://exept.exept.de:631\lj4'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9681
	    pDevModeOutput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9682
	    pDevModeInput:nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9683
	    fMode:0.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9684
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9685
     self halt.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9686
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9687
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9688
    "Created: / 27-07-2006 / 19:30:50 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9689
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9690
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  9691
primGetDeviceCaps:hwndArg index: index
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9692
    "Returns driver specific information about the device"
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9693
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9694
    <apicall: int32 "GetDeviceCaps" (handle int32) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
  9695
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9696
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9697
    "Modified: / 01-08-2006 / 16:13:05 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9698
    "Modified: / 04-10-2006 / 11:38:06 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9699
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9700
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  9701
primGetPrinter:hwndArg level:index informationBuffer:informationBuffer bufferSize:bufferSize bufferNeededSize:bufferNeededSize
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9702
    <apicall: bool "GetPrinterA" (handle dword pointer dword pointer) module: "winspool.drv" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
  9703
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9704
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9705
"
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
  9706
|hPrinter rslt printerName informationBuffer bytesNeeded sizeBytesArray ok|
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9707
     printerName := '\\http://exept.exept.de:631\lj4'.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9708
     hPrinter := self openPrinter: printerName .
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
  9709
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9710
     sizeBytesArray := ByteArray new:4.
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9711
     ok := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9712
		primGetPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9713
		level:2
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9714
		informationBuffer: nil
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9715
		bufferSize: 0
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9716
		bufferNeededSize:sizeBytesArray.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9717
     bytesNeeded := sizeBytesArray longAt:1.
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
  9718
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
  9719
     informationBuffer := PrinterInfo2Structure new: bytesNeeded.
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9720
     rslt := self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9721
		primGetPrinter:hPrinter
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9722
		level:2
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9723
		informationBuffer:informationBuffer
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9724
		bufferSize: bytesNeeded
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9725
		bufferNeededSize:sizeBytesArray.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9726
     self assert: rslt.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9727
     informationBuffer inspect.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9728
     self closePrinter: printerName.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9729
"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9730
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9731
    "Modified: / 01-08-2006 / 12:39:26 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9732
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9733
11085
ff0e28fd7027 changed #primReleaseMutex:
fm
parents: 11084
diff changeset
  9734
primGetTextExtentPoint: handle string: lpString count: nCount size: pSize
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9735
    <apicall: bool "GetTextExtentPointA" (handle pointer int32 pointer) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
  9736
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9737
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9738
    "Created: / 03-08-2006 / 11:06:23 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9739
    "Modified: / 04-10-2006 / 11:38:21 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9740
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9741
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9742
primGetTextMetrics: deviceContext lpMetrics: textMetrics
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9743
    <apicall: bool "GetTextMetricsA" (handle pointer) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
  9744
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9745
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9746
    "Modified: / 02-08-2006 / 16:17:51 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9747
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9748
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9749
primOpenPrinter:name handleHolder:handleHolder ignored: ignored
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9750
    <apicall: bool "OpenPrinterA" ( lpstr lpstr lpstr ) module: "winspool.drv" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
  9751
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9752
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9753
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9754
     |h hh rslt|
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9755
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9756
     hh := ByteArray new:4.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9757
     rslt := self primOpenPrinter:'\\http://exept.exept.de:631\lj4' handleHolder:hh ignored: nil.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9758
     h := Win32Handle new setAddressFromBytes:hh.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9759
     self halt.
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9760
    "
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9761
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9762
    "Created: / 27-07-2006 / 14:39:35 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9763
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9764
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9765
primSetTextAlign:handle with:fMode
10180
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
  9766
    <apicall: bool "SetTextAlign" (handle int16) module: "gdi32.dll" >
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
  9767
    "SetTextAlign"
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
  9768
    "gdi32.dll"
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
  9769
10180
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
  9770
    self primitiveFailed.
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
  9771
!
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
  9772
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
  9773
primSetViewportOrgEx: h x: x y: y oldOrigin: oldOrigin
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
  9774
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
  9775
    <apicall: bool "SetViewportOrgEx" (handle int16 int16 pointer) module: "gdi32.dll" >
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
  9776
    self primitiveFailed.
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
  9777
!
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
  9778
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  9779
primStartDoc:hwndArg docInfo: aDocInfo
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9780
    "Returns a jobId"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9781
    <apicall: int32 "StartDocA" (handle pointer) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
  9782
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9783
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9784
    "Modified: / 31-07-2006 / 11:47:10 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9785
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9786
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
  9787
primStartPage:hwndArg
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9788
    <apicall: int32 "StartPage" (handle) module: "gdi32.dll" >
9484
b9c80492105b *** empty log message ***
fm
parents: 9475
diff changeset
  9789
    self primitiveFailed.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9790
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9791
    "Created: / 27-07-2006 / 19:02:12 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9792
    "Modified: / 31-07-2006 / 11:47:06 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9793
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9794
10180
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
  9795
setTextAlign: fMode to: handle
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
  9796
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
  9797
    self primSetTextAlign: handle with: fMode
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
  9798
!
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
  9799
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
  9800
setViewportOrg: h x: x y: y oldOrigin: oldOrigin
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
  9801
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
  9802
    self primSetViewportOrgEx: h x: x y: y oldOrigin: oldOrigin
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
  9803
!
41e99d88d4bc *** empty log message ***
fm
parents: 10164
diff changeset
  9804
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9805
startDoc: deviceContext docInfo: docInfoStruct
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9806
    ^self primStartDoc:deviceContext docInfo: docInfoStruct
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9807
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9808
    "Created: / 27-07-2006 / 19:42:39 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9809
    "Modified: / 04-10-2006 / 11:38:30 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9810
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9811
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9812
startPage: deviceContext
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9813
    ^self primStartPage:deviceContext
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9814
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9815
    "Created: / 27-07-2006 / 19:43:56 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9816
    "Modified: / 28-07-2006 / 18:48:58 / fm"
10026
d47b931f54fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10014
diff changeset
  9817
    "Modified: / 04-10-2006 / 11:38:34 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9818
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
  9819
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9820
!Win32OperatingSystem class methodsFor:'private'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9821
7777
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9822
mapLanguage:aWindowsLanguageString
9013
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  9823
    "map a windows language string to ISO languageCode_languageTerritory format"
7777
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9824
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9825
    |windowsLanguageString|
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9826
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9827
    windowsLanguageString := aWindowsLanguageString asUppercase.
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9828
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9829
    #('DEU'     'de_DE'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9830
      'DES'     'de_CH'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9831
      'DEA'     'de_AT'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9832
      'DAN'     'da_DA'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9833
      'ENA'     'en_AU'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9834
      'ENC'     'en_CA'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9835
      'ENG'     'en_GB'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9836
      'ENI'     'en_IR'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9837
      'ENU'     'en_US'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9838
      'ENZ'     'en_NZ'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9839
      'FRA'     'fr_FR'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9840
      'FRB'     'fr_BE'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9841
      'FRC'     'fr_CA'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9842
      'FRS'     'fr_CH'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9843
      'ITA'     'it_IT'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9844
      'ITS'     'it_CH'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9845
      'ESM'     'es_MX'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9846
      'ESN'     'es_ES'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9847
      'ESP'     'es'            "Castillian"
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9848
      'NLB'     'nl_BE'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9849
      'NLD'     'nl_NL'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9850
      'CSY'     'cs_CS'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9851
      'ELL'     'el_EL'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9852
      'NON'     'no_NO'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9853
      'NOR'     'no_NO'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9854
     ) pairWiseDo:[:key :mappedValue|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9855
	key = windowsLanguageString ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9856
	    ^ mappedValue
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9857
	]
7777
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9858
    ].
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9859
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9860
    "no mapping"
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9861
    ^ windowsLanguageString.
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9862
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9863
    "
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  9864
     self mapLanguage:'DEU'
7777
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9865
    "
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9866
!
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  9867
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9868
osProcessStatusClass
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9869
    ^ OSProcessStatus
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9870
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9871
    "Created: / 12.6.1998 / 16:30:43 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9872
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9873
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9874
!Win32OperatingSystem class methodsFor:'regional settings'!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9875
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9876
country
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9877
	"Answer the current system value for country."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9878
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9879
    ^self queryNationalProfileString: 'iCountry' default: 0
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9880
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9881
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9882
	self country
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9883
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9884
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9885
    "Modified: / 22-12-2006 / 16:45:32 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9886
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9887
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9888
countryName
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9889
	"Answer the current system value for country name."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9890
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9891
    ^self queryNationalProfileString: 'sCountry' default: 'Deutschland'
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9892
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9893
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9894
	self countryName
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9895
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9896
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9897
    "Modified: / 22-12-2006 / 16:45:32 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9898
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9899
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9900
dateFormat
13324
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
  9901
    "Answer the current system value for date format.
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
  9902
     Answer DfMDY = Month-Day-Year
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9903
	    DfDMY = Day-Month-Year
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9904
	    DfYMD = Year-Month-Day."
13324
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
  9905
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
  9906
    |separatorString code|
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9907
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9908
    separatorString := self dateSeparator.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9909
13324
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
  9910
    code := self dateFormatCode.
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
  9911
    code = 0 ifTrue:[ ^ '%(mon)', separatorString, '%(day)', separatorString, '%(year)' ].
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
  9912
    code = 1 ifTrue:[ ^ '%(day)', separatorString, '%(mon)', separatorString, '%(year)' ].
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
  9913
    code = 2 ifTrue:[ ^ '%(year)', separatorString, '%(mon)', separatorString, '%(day)' ].
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
  9914
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
  9915
    ^ '%(day)', separatorString, '%(mon)', separatorString, '%(year)'
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
  9916
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
  9917
    "
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
  9918
     self dateFormat
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9919
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9920
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9921
    "Modified: / 22-12-2006 / 16:43:30 / User"
13324
ca08328dd255 changed: #dateFormat
Claus Gittinger <cg@exept.de>
parents: 13315
diff changeset
  9922
    "Modified: / 28-03-2011 / 17:10:01 / cg"
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9923
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9924
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9925
dateFormatCode
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9926
	"Answer the current system value for date format.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9927
	 Answer DfMDY = Month-Day-Year = 0
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9928
		DfDMY = Day-Month-Year = 1
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9929
		DfYMD = Year-Month-Day = 2"
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9930
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9931
    ^self queryNationalProfileInt: 'iDate' default: 0
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9932
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9933
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9934
	self dateFormatCode
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9935
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9936
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9937
    "Modified: / 22-12-2006 / 16:45:53 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9938
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9939
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9940
dateSeparator
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9941
	"Answer the current system value for date separator."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9942
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9943
    ^self queryNationalProfileString: 'sDate' default: '/'
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9944
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9945
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9946
	self dateSeparator
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9947
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9948
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9949
    "Modified: / 22-12-2006 / 16:45:32 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9950
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9951
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9952
decimalSeparator
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9953
	"Answer the current system value for decimal separator."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9954
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9955
    ^self queryNationalProfileString: 'sDecimal' default: '.'
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9956
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9957
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9958
	self decimalSeparator
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9959
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9960
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9961
    "Created: / 22-12-2006 / 16:45:11 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9962
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9963
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9964
isDateFormatDMY
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9965
	"Answer the current system value for date format.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9966
	 Answer DfMDY = Month-Day-Year
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9967
		DfDMY = Day-Month-Year
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9968
		DfYMD = Year-Month-Day."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9969
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9970
    ^self dateFormatCode = 1
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9971
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9972
    "Created: / 18-01-2007 / 14:56:23 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9973
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9974
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9975
isDateFormatMDY
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9976
	"Answer the current system value for date format.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9977
	 Answer DfMDY = Month-Day-Year
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9978
		DfDMY = Day-Month-Year
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9979
		DfYMD = Year-Month-Day."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9980
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9981
    ^self dateFormatCode = 0
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9982
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9983
    "Created: / 18-01-2007 / 14:56:07 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9984
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9985
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9986
isDateFormatYMD
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9987
	"Answer the current system value for date format.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9988
	 Answer DfMDY = Month-Day-Year
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9989
		DfDMY = Day-Month-Year
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9990
		DfYMD = Year-Month-Day."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9991
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9992
    ^self dateFormatCode = 2
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9993
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9994
    "Created: / 18-01-2007 / 14:56:30 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9995
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9996
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9997
isTimeFormat12Hour
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
  9998
	"Answer whether the current system time format is 12-hour."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
  9999
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10000
    ^self timeFormat = 0
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10001
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10002
    "Created: / 22-12-2006 / 16:48:17 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10003
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10004
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10005
primGetProfileInt: appName keyName: keyName default: anInt
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10006
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10007
    <apicall: uint32 "GetProfileIntA" ( lpstr lpstr uint32) module: "kernel32.dll" >
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10008
    ^self primitiveFailed
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10009
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10010
    "Created: / 22-12-2006 / 16:17:18 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10011
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10012
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10013
primGetProfileString: appName keyName: keyName default: defaultStr returnedString: retStr size: anInt
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10014
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10015
    <apicall: uint32 "GetProfileStringA" ( lpstr lpstr lpstr lpstr uint32) module: "kernel32.dll" >
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10016
    ^self primitiveFailed
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10017
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10018
    "Created: / 22-12-2006 / 16:20:23 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10019
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10020
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10021
queryNationalProfileInt: aKeyName default: defaultValue
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10022
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10023
    | answer |
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10024
    answer := self primGetProfileInt: 'Intl'
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10025
	keyName: aKeyName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10026
	default: -1 asUnsigned32.
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10027
    ^answer = -1 asUnsigned32
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10028
	ifTrue: [ defaultValue ]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10029
	ifFalse: [ answer ]
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10030
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10031
"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10032
    self queryNationalProfileInt: 'iDate' default: 0
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10033
"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10034
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10035
    "Modified: / 22-12-2006 / 16:23:05 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10036
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10037
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10038
queryNationalProfileString: aKeyName default: defaultValue
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10039
	"Answer the string value of key aKeyName in
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10040
	the [Intl] application section of the WIN.INI profile file.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10041
	Answer defaultValue if aKeyName cannot be found."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10042
    | extString result |
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10043
    extString := String new: 80.
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10044
    result := self primGetProfileString: 'Intl'
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10045
	keyName: aKeyName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10046
	default: ''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10047
	returnedString: extString
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10048
	size: extString size.
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10049
    ^result > 0
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10050
	ifTrue: [extString copyFrom: 1 to: result]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10051
	ifFalse: [ defaultValue ]
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10052
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10053
    "Created: / 22-12-2006 / 16:13:01 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10054
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10055
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10056
thousandsSeparator
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10057
	"Answer the current system value
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10058
	for the thousands separator."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10059
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10060
    ^self queryNationalProfileString: 'sThousand' default: ','
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10061
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10062
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10063
	self thousandsSeparator
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10064
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10065
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10066
    "Created: / 22-12-2006 / 16:46:50 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10067
!
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10068
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10069
timeFormat
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10070
	"Answer the current system value for time format."
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10071
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10072
    ^self queryNationalProfileInt: 'iTime' default: 0
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10073
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10074
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10075
	self timeFormat
10968
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10076
    "
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10077
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10078
    "Created: / 22-12-2006 / 16:48:27 / User"
f9da8a9c476c dapasx extensions moved to class
fm
parents: 10913
diff changeset
 10079
! !
10913
b9a2c48a0043 *** empty log message ***
fm
parents: 10792
diff changeset
 10080
9093
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
 10081
!Win32OperatingSystem class methodsFor:'registry support'!
9013
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10082
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10083
registryEntry
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10084
    "provide access to the registryEntry class"
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10085
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10086
    ^ RegistryEntry
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10087
! !
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10088
9088
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 10089
!Win32OperatingSystem class methodsFor:'serial port support'!
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 10090
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 10091
serialPortAccessor
9093
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
 10092
    "provide access to the serial port class"
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
 10093
9088
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 10094
    ^ Win32SerialPortHandle
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 10095
! !
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 10096
9115
65f7004dae93 WIn32Shell and IUnknown stuff
Claus Gittinger <cg@exept.de>
parents: 9113
diff changeset
 10097
!Win32OperatingSystem class methodsFor:'shell operations'!
65f7004dae93 WIn32Shell and IUnknown stuff
Claus Gittinger <cg@exept.de>
parents: 9113
diff changeset
 10098
15472
2eb14b1eaf06 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15464
diff changeset
 10099
openApplicationForDocument:fileOrUrl operation:operationSymbol mimeType:mimeType
13108
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10100
    "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
 10101
     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
 10102
     html documents, pdf documents etc.
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10103
     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
 10104
	open
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10105
	edit
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10106
	explore
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10107
	print
15472
2eb14b1eaf06 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15464
diff changeset
 10108
    "
2eb14b1eaf06 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15464
diff changeset
 10109
2eb14b1eaf06 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15464
diff changeset
 10110
    self
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10111
	shellExecute:nil
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10112
	lpOperation:operationSymbol
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10113
	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
 10114
	lpParameters:nil
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 10115
	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
 10116
	nShowCmd:#SW_SHOWNORMAL.
15472
2eb14b1eaf06 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15464
diff changeset
 10117
13108
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10118
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10119
    "
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10120
     self openApplicationForDocument: Filename currentDirectory operation:#open
15472
2eb14b1eaf06 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15464
diff changeset
 10121
     self openApplicationForDocument: 'C:\' operation:#open
13108
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10122
     self openApplicationForDocument: '..\..\doc\books\ArtOfSmalltalk\artMissing186187Fix1.pdf' asFilename operation:#open
15472
2eb14b1eaf06 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15464
diff changeset
 10123
     self openApplicationForDocument: 'http://www.exept.de' asFilename operation:#open
13108
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10124
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10125
     self openApplicationForDocument: 'C:\WINDOWS\Help\clipbrd.chm' asFilename operation:#open
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10126
    "
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10127
1bfda4fe09e0 category of: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 12987
diff changeset
 10128
    "Created: / 04-08-2006 / 18:04:52 / fm"
13284
d3828897bd5b comment/format in: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 13224
diff changeset
 10129
    "Modified: / 05-02-2011 / 16:25:31 / cg"
13223
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 10130
! !
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 10131
9093
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
 10132
!Win32OperatingSystem class methodsFor:'socket support'!
8270
df0083a70225 temporary kludge for SOcketAccessor/SocketHandle
ca
parents: 8265
diff changeset
 10133
df0083a70225 temporary kludge for SOcketAccessor/SocketHandle
ca
parents: 8265
diff changeset
 10134
socketAccessor
9093
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
 10135
    "provide access to the socket handle class"
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
 10136
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 10137
    ^ Win32SocketHandle
8270
df0083a70225 temporary kludge for SOcketAccessor/SocketHandle
ca
parents: 8265
diff changeset
 10138
! !
df0083a70225 temporary kludge for SOcketAccessor/SocketHandle
ca
parents: 8265
diff changeset
 10139
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10140
!Win32OperatingSystem class methodsFor:'system management'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10141
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10142
exitWindows
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10143
    "do not use - may be removed without notice"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10144
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10145
    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
 10146
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10147
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10148
exitWindows:how confirm:confirmationMessageOrNil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10149
    "this method is temporary -
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10150
     since my windows system menu crashes so often
7850
087b4ca01736 comment & unneeded method removed
ca
parents: 7841
diff changeset
 10151
     (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
 10152
     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
 10153
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10154
    confirmationMessageOrNil notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10155
	(Dialog confirm:confirmationMessageOrNil) ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10156
	    ^ false
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10157
	].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10158
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10159
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10160
    int flag;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10161
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10162
    if (how == @symbol(shutdown)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10163
	flag = EWX_SHUTDOWN;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10164
    } else if (how == @symbol(reboot)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10165
	flag = EWX_REBOOT;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10166
    } else if (how == @symbol(logoff)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10167
	flag = EWX_LOGOFF;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10168
    } else if (how == @symbol(forceShutdown)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10169
	flag = EWX_SHUTDOWN | EWX_FORCE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10170
    } else if (how == @symbol(forceReboot)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10171
	flag = EWX_REBOOT | EWX_FORCE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10172
    } else if (how == @symbol(forceLogoff)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10173
	flag = EWX_LOGOFF | EWX_FORCE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10174
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10175
	RETURN (false);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10176
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10177
    RETURN ((ExitWindowsEx(flag, 0) == TRUE) ? true : false);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10178
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10179
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10180
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10181
!Win32OperatingSystem class methodsFor:'time and date'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10182
8640
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
 10183
computeOSTimeFromUTCYear:y month:m day:d hour:h minute:min second:s millisecond:millis
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
 10184
    "return the OS-dependent time for the given time and day.
9384
5c5dd48a9fdd Fix localTime / utcTime conversion
Stefan Vogel <sv@exept.de>
parents: 9381
diff changeset
 10185
     The arguments are assumed to be in UTC time."
8640
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
 10186
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
 10187
%{
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
 10188
    if (__bothSmallInteger(y, m)
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
 10189
     && __bothSmallInteger(d, h)
12934
bc516945ce4d changed:
Claus Gittinger <cg@exept.de>
parents: 12908
diff changeset
 10190
     && __bothSmallInteger(min, s)
bc516945ce4d changed:
Claus Gittinger <cg@exept.de>
parents: 12908
diff changeset
 10191
     && __isSmallInteger(millis)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10192
	SYSTEMTIME sysTime;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10193
	FILETIME fileTime;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10194
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10195
	sysTime.wHour = __intVal(h);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10196
	sysTime.wMinute = __intVal(min);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10197
	sysTime.wSecond = __intVal(s);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10198
	sysTime.wMilliseconds = __intVal(millis);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10199
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10200
	sysTime.wYear = __intVal(y);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10201
	sysTime.wMonth = __intVal(m);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10202
	sysTime.wDay = __intVal(d);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10203
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10204
	if (SystemTimeToFileTime(&sysTime, &fileTime) == 0)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10205
	    goto error;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10206
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10207
	RETURN(FileTimeToOsTime(&fileTime));
9384
5c5dd48a9fdd Fix localTime / utcTime conversion
Stefan Vogel <sv@exept.de>
parents: 9381
diff changeset
 10208
    }
5c5dd48a9fdd Fix localTime / utcTime conversion
Stefan Vogel <sv@exept.de>
parents: 9381
diff changeset
 10209
error:;
8640
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
 10210
%}.
12821
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
 10211
    "Error, some invalid date ot time"
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
 10212
    ^ TimeConversionError raiseRequest
8640
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
 10213
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
 10214
    "
9384
5c5dd48a9fdd Fix localTime / utcTime conversion
Stefan Vogel <sv@exept.de>
parents: 9381
diff changeset
 10215
     OperatingSystem computeOSTimeFromUTCYear:1970 month:1 day:1 hour:0 minute:0 second:0 millisecond:0
12821
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
 10216
    invalid:
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
 10217
     OperatingSystem computeOSTimeFromUTCYear:1970 month:1 day:1 hour:24 minute:0 second:0 millisecond:0
8640
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
 10218
    "
12934
bc516945ce4d changed:
Claus Gittinger <cg@exept.de>
parents: 12908
diff changeset
 10219
bc516945ce4d changed:
Claus Gittinger <cg@exept.de>
parents: 12908
diff changeset
 10220
    "Modified: / 07-07-2010 / 16:56:21 / cg"
8640
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
 10221
!
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
 10222
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10223
computeOSTimeFromYear:y month:m day:d hour:h minute:min seconds:s millis:millis
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 10224
    "return the OS-dependent time for the given time and day.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10225
     The arguments are assumed to be in localtime including
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10226
     any daylight saving adjustings."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10227
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10228
%{
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 10229
    if (__bothSmallInteger(y, m)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10230
     && __bothSmallInteger(d, h)
12934
bc516945ce4d changed:
Claus Gittinger <cg@exept.de>
parents: 12908
diff changeset
 10231
     && __bothSmallInteger(min, s)
bc516945ce4d changed:
Claus Gittinger <cg@exept.de>
parents: 12908
diff changeset
 10232
     && __isSmallInteger(millis)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10233
	SYSTEMTIME sysTime;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10234
	FILETIME fileTime;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10235
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10236
	sysTime.wHour = __intVal(h);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10237
	sysTime.wMinute = __intVal(min);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10238
	sysTime.wSecond = __intVal(s);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10239
	sysTime.wMilliseconds = __intVal(millis);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10240
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10241
	sysTime.wYear = __intVal(y);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10242
	sysTime.wMonth = __intVal(m);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10243
	sysTime.wDay = __intVal(d);
12820
bb674e2ebc2a changed:
Stefan Vogel <sv@exept.de>
parents: 12818
diff changeset
 10244
12828
f54b32946f7f changed: #computeOSTimeFromYear:month:day:hour:minute:seconds:millis:
Stefan Vogel <sv@exept.de>
parents: 12827
diff changeset
 10245
#if 0
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10246
	/* Sorry, but this function is not supported in Win2000
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10247
	   - we use LocalFileTimeToFileTime */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10248
	if (TzSpecificLocalTimeToSystemTime(0, &sysTime, &sysTime) == 0)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10249
	    goto error;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10250
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10251
	if (SystemTimeToFileTime(&sysTime, &fileTime) == 0)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10252
	    goto error;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10253
	if (LocalFileTimeToFileTime(&fileTime, &fileTime) == 0)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10254
	    goto error;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10255
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10256
	RETURN(FileTimeToOsTime(&fileTime));
12820
bb674e2ebc2a changed:
Stefan Vogel <sv@exept.de>
parents: 12818
diff changeset
 10257
    }
bb674e2ebc2a changed:
Stefan Vogel <sv@exept.de>
parents: 12818
diff changeset
 10258
error:;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10259
%}.
12821
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
 10260
    "Error, some invalid date ot time"
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
 10261
    ^ TimeConversionError raiseRequest
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10262
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10263
    "
12820
bb674e2ebc2a changed:
Stefan Vogel <sv@exept.de>
parents: 12818
diff changeset
 10264
     OperatingSystem computeOSTimeFromUTCYear:1970 month:1 day:1 hour:0 minute:0 second:0 millisecond:0
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10265
     OperatingSystem computeOSTimeFromYear:1970 month:1 day:1 hour:0 minute:0 seconds:0 millis:0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10266
    "
12934
bc516945ce4d changed:
Claus Gittinger <cg@exept.de>
parents: 12908
diff changeset
 10267
bc516945ce4d changed:
Claus Gittinger <cg@exept.de>
parents: 12908
diff changeset
 10268
    "Modified: / 07-07-2010 / 16:56:56 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10269
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10270
11746
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10271
getMicrosecondTime
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10272
    "This returns a microsecond timer value.
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10273
     The returned value is a 64bit value
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10274
     (which is the number of microseconds since the system's boot time -
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10275
      but you should not depend on that because it is system specific.
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10276
     Only use for relative delta-times."
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10277
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10278
%{  /* NOCONTEXT */
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10279
    static int frequencyKnown = 0;
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10280
    static LONGLONG ticksPerSecond;
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10281
    static LONGLONG divisor;
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10282
    LONGLONG tick;     // A point in time
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 10283
    LONGLONG micros;
11746
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10284
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10285
    if (! frequencyKnown) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10286
	// get the high resolution counter's accuracy
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10287
	QueryPerformanceFrequency(&ticksPerSecond);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10288
	frequencyKnown = 1;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10289
	divisor = ticksPerSecond / (LONGLONG)1000000;
11746
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10290
    }
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10291
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10292
    // what time is it?
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10293
    QueryPerformanceCounter(&tick);
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10294
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10295
    micros = tick / divisor;
12821
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
 10296
    RETURN ( __MKLARGEINT64(1, (micros & 0xFFFFFFFF), (micros >> 32)) );
11746
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10297
%}
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10298
    "
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10299
     |t1 t2 dT|
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10300
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10301
     t1 := self getMicrosecondTime.
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10302
     Delay waitForSeconds:1.
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10303
     t2 := self getMicrosecondTime.
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 10304
     dT := t2 - t1
11746
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10305
    "
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10306
    "
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10307
     |t1 t2 dT|
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10308
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10309
     t1 := self getMillisecondTime.
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10310
     Delay waitForSeconds:1.
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10311
     t2 := self getMillisecondTime.
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 10312
     dT := t2 - t1
11746
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10313
    "
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10314
!
da465966ff92 +getMicroSecondTime
Claus Gittinger <cg@exept.de>
parents: 11669
diff changeset
 10315
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10316
getMillisecondTime
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 10317
    "This returns the millisecond timers value.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10318
     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
 10319
     LargeInteger arithmetic when doing timeouts and delays.
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 10320
     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
 10321
     this can only be used for short relative time deltas.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10322
     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
 10323
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10324
     BAD DESIGN:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10325
	This should be changed to return some instance of RelativeTime,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10326
	and these computations moved there.
11800
bfd3073ef9d2 #getMillisecondTime - comment
Stefan Vogel <sv@exept.de>
parents: 11779
diff changeset
 10327
bfd3073ef9d2 #getMillisecondTime - comment
Stefan Vogel <sv@exept.de>
parents: 11779
diff changeset
 10328
     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
 10329
     interface. For compatibility with ST-80, use Time millisecondClockValue.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10330
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10331
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10332
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10333
12838
9b773959a7c7 changed: #getMillisecondTime
Stefan Vogel <sv@exept.de>
parents: 12837
diff changeset
 10334
    RETURN ( __mkSmallInteger(GetTickCount() & 0x1FFFFFFF) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10335
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10336
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10337
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10338
getOSTime
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10339
    "This returns the OS time.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10340
     The base of the returned value is not consistent across
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10341
     different OS's - some return the number of millis since jan, 1st 1970;
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 10342
     others since 1900. The Time classes are prepared for this, and
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10343
     converts as appropriate (by using my fromOSTime: conversion methods).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10344
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10345
     Dont use this method in application code since it is an internal (private)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10346
     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
 10347
     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
 10348
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10349
%{
12817
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10350
    FILETIME fileTime;
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10351
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10352
    GetSystemTimeAsFileTime(&fileTime);
12821
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
 10353
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
 10354
    RETURN(FileTimeToOsTime(&fileTime));
56c56e8bee2a Raise TimeConversionError if appropriate.
Stefan Vogel <sv@exept.de>
parents: 12820
diff changeset
 10355
%}.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10356
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10357
    "
12817
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10358
     OperatingSystem getOSTime.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10359
     Delay waitForSeconds:0.2.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10360
     OperatingSystem getOSTime printCR.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10361
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10362
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10363
11842
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10364
getTimezoneInformation
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10365
    "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
 10366
     AbstractOperatingSystem::TimeZoneInformation for details"
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10367
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10368
    |error bias standardName
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10369
     standardDate_y standardDate_m standardDate_d standardDate_wd
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10370
     standardDate_h standardDate_min standardDate_s
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 10371
     standardBias
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 10372
     daylightName
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 10373
     daylightDate_y daylightDate_m daylightDate_d daylightDate_wd
11842
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10374
     daylightDate_h daylightDate_min daylightDate_s
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10375
     daylightBias info|
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10376
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10377
%{
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 10378
    TIME_ZONE_INFORMATION tzInfo;
11842
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10379
    DWORD retVal;
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10380
    WCHAR nm[33];
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10381
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10382
    retVal = GetTimeZoneInformation(&tzInfo);
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10383
    switch (retVal) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10384
	case TIME_ZONE_ID_INVALID:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10385
	    error = __mkSmallInteger(__WIN32_ERR(GetLastError()));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10386
	    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10387
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10388
	case TIME_ZONE_ID_UNKNOWN:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10389
	case TIME_ZONE_ID_STANDARD:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10390
	case TIME_ZONE_ID_DAYLIGHT:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10391
	default:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10392
	    bias = __mkSmallInteger(tzInfo.Bias);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10393
	    memmove(nm, tzInfo.StandardName, 32*sizeof(WCHAR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10394
	    nm[32] = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10395
	    standardName = __MKU16STRING(nm);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10396
	    standardDate_y = __mkSmallInteger(tzInfo.StandardDate.wYear);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10397
	    standardDate_m = __mkSmallInteger(tzInfo.StandardDate.wMonth);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10398
	    standardDate_d = __mkSmallInteger(tzInfo.StandardDate.wDay);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10399
	    standardDate_wd = __mkSmallInteger(tzInfo.StandardDate.wDayOfWeek);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10400
	    standardDate_h = __mkSmallInteger(tzInfo.StandardDate.wHour);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10401
	    standardDate_min = __mkSmallInteger(tzInfo.StandardDate.wMinute);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10402
	    standardDate_s = __mkSmallInteger(tzInfo.StandardDate.wSecond);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10403
	    standardBias =  __mkSmallInteger(tzInfo.StandardBias);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10404
	    memmove(nm, tzInfo.DaylightName, 32*sizeof(WCHAR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10405
	    nm[32] = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10406
	    daylightName = __MKU16STRING(nm);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10407
	    daylightDate_y = __mkSmallInteger(tzInfo.DaylightDate.wYear);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10408
	    daylightDate_m = __mkSmallInteger(tzInfo.DaylightDate.wMonth);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10409
	    daylightDate_d = __mkSmallInteger(tzInfo.DaylightDate.wDay);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10410
	    daylightDate_wd = __mkSmallInteger(tzInfo.DaylightDate.wDayOfWeek);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10411
	    daylightDate_h = __mkSmallInteger(tzInfo.DaylightDate.wHour);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10412
	    daylightDate_min = __mkSmallInteger(tzInfo.DaylightDate.wMinute);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10413
	    daylightDate_s = __mkSmallInteger(tzInfo.DaylightDate.wSecond);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10414
	    daylightBias =  __mkSmallInteger(tzInfo.DaylightBias);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10415
	    break;
11842
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10416
    }
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10417
%}.
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10418
    error notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10419
	self primitiveFailed.
11842
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10420
    ].
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10421
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10422
    info := AbstractOperatingSystem::TimeZoneInfo new.
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 10423
    info
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10424
	bias:bias
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10425
	name:standardName standardBias:standardBias
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10426
	daylightName:daylightName daylightBias:daylightBias.
11842
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10427
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10428
    standardDate_m ~~ 0 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10429
	info standardYear:standardDate_y standardMonth:standardDate_m standardDay:standardDate_d
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10430
	     standardWeekDay:standardDate_wd standardHour:standardDate_h standardMinute:standardDate_min.
11842
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10431
    ].
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10432
    daylightDate_m ~~ 0 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10433
	info daylightYear:daylightDate_y daylightMonth:daylightDate_m daylightDay:daylightDate_d
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10434
	     daylightWeekDay:daylightDate_wd daylightHour:daylightDate_h daylightMinute:daylightDate_min.
11842
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10435
    ].
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10436
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10437
    ^ info
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10438
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10439
    "
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10440
     self getTimezoneInformation
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10441
    "
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10442
!
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10443
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10444
sleep:numberOfSeconds
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10445
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10446
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10447
    "cease ANY action for some time. This suspends the whole smalltalk
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10448
     (unix-) process for some time.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10449
     Not really useful since not even low-prio processes and interrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10450
     handling will run during the sleep.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10451
     Use either OperatingSystem>>millisecondDelay: (which makes all
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10452
     threads sleep, but handles interrupts) or use a Delay (which makes
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10453
     only the calling thread sleep)."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10454
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10455
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10456
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10457
    if (__isSmallInteger(numberOfSeconds)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10458
	sleep(__intVal(numberOfSeconds));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10459
	RETURN ( self );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10460
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10461
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10462
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10463
     argument not integer
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10464
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10465
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10466
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10467
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10468
     OperatingSystem sleep:2
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10469
    "
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 10470
!
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 10471
8889
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
 10472
timeInfoFromSeconds:osSeconds milliseconds:osMilliseconds localTime:isLocalTime
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 10473
    "return a timeInfo structure containing values for the given
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 10474
     OS-second value.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 10475
     An internal helper"
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 10476
12817
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10477
    |year month day hours minutes seconds utcOffset dstOffset
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10478
     dst yDay weekDay info reason|
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10479
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10480
%{
9431
cae760dd7d80 oops: localtime and gmtime could return a NULL-ptr.
Claus Gittinger <cg@exept.de>
parents: 9424
diff changeset
 10481
    UINT t;
12817
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10482
    FILETIME fileTime, localFileTime;
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10483
    SYSTEMTIME sysTime;
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 10484
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 10485
    t = __longIntVal(osSeconds);
8889
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
 10486
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
 10487
    /* try cache */
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
 10488
    {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10489
	OBJ lastSeconds, lastTimeInfo;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10490
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10491
	lastSeconds = @global(LastTimeInfoSeconds);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10492
	if (lastSeconds
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10493
	 && (__longIntVal(lastSeconds) == t)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10494
	 && (@global(LastTimeInfoMilliseconds) == osMilliseconds)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10495
	 && (@global(LastTimeInfoIsLocal) == isLocalTime)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10496
	) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10497
	    lastTimeInfo = @global(LastTimeInfo);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10498
	    if (lastTimeInfo != nil) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10499
		RETURN (lastTimeInfo);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10500
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10501
	}
11129
Claus Gittinger <cg@exept.de>
parents: 11092
diff changeset
 10502
    }
12817
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10503
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10504
    TimetToFileTime((time_t)t, &fileTime);
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 10505
8889
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
 10506
    if (isLocalTime == true) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10507
	TIME_ZONE_INFORMATION tzInfo;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10508
	int tzState;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10509
	LONGLONG longTime;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10510
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10511
	FileTimeToLocalFileTime(&fileTime, &localFileTime);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10512
	FileTimeToSystemTime(&localFileTime, &sysTime);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10513
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10514
	longTime = ((LONGLONG)fileTime.dwHighDateTime << 32) + fileTime.dwLowDateTime;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10515
	longTime -= ((LONGLONG)localFileTime.dwHighDateTime << 32) + localFileTime.dwLowDateTime;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10516
	utcOffset = __mkSmallInteger((INT)(longTime / 10000000));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10517
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10518
	if ((tzState = GetTimeZoneInformation(&tzInfo)) < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10519
	    reason = @symbol(getTimeZoneFailed);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10520
	    goto error;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10521
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10522
	dstOffset = __mkSmallInteger((tzInfo.Bias + tzInfo.DaylightBias) * 60);
8889
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
 10523
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10524
	FileTimeToSystemTime(&fileTime, &sysTime);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10525
	utcOffset = __mkSmallInteger(0);
12817
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10526
    }
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10527
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10528
    hours = __mkSmallInteger(sysTime.wHour);
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10529
    minutes = __mkSmallInteger(sysTime.wMinute);
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10530
    seconds = __mkSmallInteger(sysTime.wSecond);
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10531
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10532
    year = __mkSmallInteger(sysTime.wYear);
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10533
    month = __mkSmallInteger(sysTime.wMonth);
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10534
    day = __mkSmallInteger(sysTime.wDay);
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10535
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10536
    weekDay = __mkSmallInteger(sysTime.wDayOfWeek == 0 ? 7 : sysTime.wDayOfWeek);
9384
5c5dd48a9fdd Fix localTime / utcTime conversion
Stefan Vogel <sv@exept.de>
parents: 9381
diff changeset
 10537
error:;
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 10538
%}.
12817
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10539
    year isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10540
	^ self primitiveFailed
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 10541
    ].
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 10542
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 10543
    info := self timeInfoClass new.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 10544
    info
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10545
	year:year
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10546
	month:month
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10547
	day:day
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10548
	hours:hours
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10549
	minutes:minutes
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10550
	seconds:seconds
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10551
	milliseconds:osMilliseconds
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10552
	utcOffset:utcOffset
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10553
	dst:(utcOffset = dstOffset)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10554
	dayInYear:yDay
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10555
	dayInWeek:weekDay.
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
 10556
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
 10557
    LastTimeInfo := info.
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
 10558
    LastTimeInfoSeconds := osSeconds.
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
 10559
    LastTimeInfoMilliseconds := osMilliseconds.
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
 10560
    LastTimeInfoIsLocal := isLocalTime.
8889
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
 10561
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 10562
    ^ info
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 10563
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 10564
    "
8889
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
 10565
     OperatingSystem timeInfoFromSeconds:0 milliseconds:0 localTime:false
9384
5c5dd48a9fdd Fix localTime / utcTime conversion
Stefan Vogel <sv@exept.de>
parents: 9381
diff changeset
 10566
     OperatingSystem timeInfoFromSeconds:0 milliseconds:0 localTime:false
5c5dd48a9fdd Fix localTime / utcTime conversion
Stefan Vogel <sv@exept.de>
parents: 9381
diff changeset
 10567
     OperatingSystem timeInfoFromSeconds:3600 milliseconds:0 localTime:true
5c5dd48a9fdd Fix localTime / utcTime conversion
Stefan Vogel <sv@exept.de>
parents: 9381
diff changeset
 10568
     OperatingSystem timeInfoFromSeconds:Timestamp now utcSecondsSince1970 milliseconds:0 localTime:true
12817
33771eb7d88b Fix daylight saving time computations by converting from broken libc
Stefan Vogel <sv@exept.de>
parents: 12815
diff changeset
 10569
     OperatingSystem timeInfoFromSeconds:Timestamp now utcSecondsSince1970 milliseconds:0 localTime:false
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
 10570
    "
9431
cae760dd7d80 oops: localtime and gmtime could return a NULL-ptr.
Claus Gittinger <cg@exept.de>
parents: 9424
diff changeset
 10571
cae760dd7d80 oops: localtime and gmtime could return a NULL-ptr.
Claus Gittinger <cg@exept.de>
parents: 9424
diff changeset
 10572
    "Modified: / 06-07-2006 / 18:18:56 / cg"
11842
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10573
!
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10574
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10575
utcOffset
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10576
    "return the difference between UTC (Greenwich Mean Time) and the local time in seconds.
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10577
     If daylight saving time applies to ourself, take that into account.
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10578
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10579
     Add utcOffset to convert from local time to UTC time.
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10580
     Subtract utcOffset to convert from UTC time to local time.
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10581
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10582
     If utcOffset is negative, the local timezone is east of Greenwich.
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10583
     If utcOffset is positive, the local timezone is west of Greenwich."
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10584
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10585
    ^ self getTimezoneInformation utcOffset
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10586
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10587
    "
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10588
     OperatingSystem utcOffset -> -7200
43bb5d8495e0 timeZoneInfo & utcOffset stuff added
Claus Gittinger <cg@exept.de>
parents: 11833
diff changeset
 10589
    "
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10590
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10591
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10592
!Win32OperatingSystem class methodsFor:'users & groups'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10593
12970
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 10594
getApplicationDataDirectoryFor:appName
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 10595
    "return the directory, where user-and-application-specific private files are to be
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 10596
     located (ini-files, preferences etc.).
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 10597
     Under windows, something like 'C:\Users\Administrator\AppData\Roaming\<appName>'
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 10598
     is returned, here, the fallback ~/.<appName> is returned.
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 10599
     Notice that only the name is returned; the directory is not guaranteed to exist."
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 10600
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 10601
    "{ Pragma: +optSpace }"
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 10602
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 10603
    |appDataDirFromEnv appDataDirFromRegistry|
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 10604
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 10605
    appDataDirFromEnv := self getEnvironment:'APPDATA'.
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 10606
    appDataDirFromEnv notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10607
	^ appDataDirFromEnv , '\' , appName
13128
35def02e40f4 CloseHandle added in: getAllProcesses
Michael Beyl <mb@exept.de>
parents: 13114
diff changeset
 10608
    ].
35def02e40f4 CloseHandle added in: getAllProcesses
Michael Beyl <mb@exept.de>
parents: 13114
diff changeset
 10609
    appDataDirFromRegistry :=
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10610
	(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
 10611
	    valueNamed:'AppData'.
12970
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 10612
    appDataDirFromRegistry notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10613
	^ appDataDirFromRegistry , '\' , appName
12970
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 10614
    ].
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 10615
    ^ super getApplicationDataDirectoryFor:appName
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 10616
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 10617
    "
13128
35def02e40f4 CloseHandle added in: getAllProcesses
Michael Beyl <mb@exept.de>
parents: 13114
diff changeset
 10618
     OperatingSystem getApplicationDataDirectoryFor:'expecco'
12970
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 10619
    "
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 10620
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 10621
    "Created: / 29-07-2010 / 12:13:12 / sr"
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 10622
!
89cd540547d1 get appData directory
sr
parents: 12969
diff changeset
 10623
10541
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 10624
getDesktopDirectory
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10625
    "return the name of the users desktop directory (i.e. yours)."
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10626
10541
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 10627
    "{ Pragma: +optSpace }"
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 10628
10543
442329e05841 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10542
diff changeset
 10629
    |dir path|
10541
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 10630
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 10631
    path := (self registryEntry
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10632
		key:'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders')
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10633
	    valueNamed:'Desktop'.
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 10634
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 10635
    path isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10636
	"Fallback"
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10637
	dir := self getHomeDirectory.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10638
	dir isNil ifTrue:[ ^ nil ].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10639
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10640
	path := dir , '\Desktop'.
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10641
    ].
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10642
10627
bef737d1b8a7 care for -1 fd returned by CreatePipe
Claus Gittinger <cg@exept.de>
parents: 10622
diff changeset
 10643
    (self isValidPath:path) ifFalse:[ ^ nil ].
10541
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 10644
    ^ path
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 10645
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 10646
    "
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 10647
     OperatingSystem getDesktopDirectory
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 10648
    "
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 10649
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 10650
    "Created: / 16-05-2007 / 13:23:43 / cg"
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 10651
!
70872ea8cdb9 +getDesktopDirectory
Claus Gittinger <cg@exept.de>
parents: 10529
diff changeset
 10652
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10653
getDocumentsDirectory
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10654
    "return the name of the users 'Documents' directory."
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10655
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10656
    "{ Pragma: +optSpace }"
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10657
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10658
    |dir|
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10659
11920
4d2ef58645de compilable with VC9.0
Claus Gittinger <cg@exept.de>
parents: 11842
diff changeset
 10660
    dir := (self registryEntry
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10661
		key:'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders')
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10662
	    valueNamed:'Personal'.
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10663
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10664
    dir isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10665
	dir := self getHomeDirectory.
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10666
    ].
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10667
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10668
    ^ dir.
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10669
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10670
    "
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10671
     OperatingSystem getDocumentsDirectory
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10672
    "
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10673
!
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10674
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10675
getEffectiveGroupID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10676
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10677
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10678
    "return the current users (thats you) effective numeric group id.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10679
     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
 10680
     as a setuid program (of which you should think about twice)."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10681
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10682
    ^ self getGroupID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10683
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10684
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10685
     OperatingSystem getEffectiveGroupID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10686
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10687
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10688
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10689
getEffectiveUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10690
    "{ Pragma: +optSpace }"
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 the current users (thats you) effective numeric user id.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10693
     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
 10694
     as a setuid program (of which you should think about twice)."
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
    ^ self getUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10697
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10698
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10699
     OperatingSystem getEffectiveUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10700
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10701
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10702
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10703
getFullUserNameFromID:userID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10704
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10705
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10706
    "return a string with the users full name - if available.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10707
     If not, return the login name as a fallBack."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10708
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10709
    |info gecos|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10710
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10711
    info := self userInfoOf:userID.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10712
    (info notNil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10713
    and:[info includesKey:#gecos]) ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10714
	gecos := info at:#gecos.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10715
	(gecos includes:$,) ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10716
	    ^ gecos copyTo:(gecos indexOf:$,) - 1
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
	^ gecos
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10719
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10720
    ^ self getUserNameFromID:userID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10721
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10722
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 10723
     OperatingSystem getFullUserNameFromID:0
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 10724
     OperatingSystem getFullUserNameFromID:(OperatingSystem getUserID)
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 10725
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 10726
     OperatingSystem getUserNameFromID:(OperatingSystem getUserID)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10727
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10728
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10729
    "Modified: 15.7.1996 / 12:44:21 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10730
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10731
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10732
getGroupID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10733
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10734
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10735
    "return the current users (thats you) numeric group id"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10736
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10737
    ^ 1 "just a dummy for systems which do not have groupIDs"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10738
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10739
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10740
     OperatingSystem getGroupID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10741
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10742
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10743
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10744
getGroupNameFromID:aNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10745
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10746
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10747
    "return the group-name-string for a given numeric group-id"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10748
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10749
    ^ '???' "just a dummy for systems which do not have groupIDs"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10750
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10751
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10752
     OperatingSystem getGroupNameFromID:0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10753
     OperatingSystem getGroupNameFromID:10
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10754
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10755
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10756
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10757
getHomeDirectory
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10758
    "return the name of the users home directory (i.e. yours)."
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10759
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10760
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10761
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10762
    |dir|
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10763
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10764
    dir := self getEnvironment:'USERPROFILE'.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10765
    dir isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10766
	dir := '.'.
11761
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10767
    ].
94085399fdbc new: #getDocumnetDirectory
Stefan Vogel <sv@exept.de>
parents: 11746
diff changeset
 10768
    ^ dir.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10769
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10770
    "
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
 10771
     OperatingSystem getHomeDirectory
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10772
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10773
5264
9a90c499e329 return the currentDir as default fallBack for the getHomeDir query.
Claus Gittinger <cg@exept.de>
parents: 5147
diff changeset
 10774
    "Modified: / 16.2.2000 / 09:17:55 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10775
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10776
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10777
getLoginName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10778
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10779
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10780
    "return a string with the users login name (thats yours)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10781
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10782
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10783
    static char cachedName[64];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10784
    static firstCall = 1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10785
#ifndef __BORLANDC__
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10786
    extern char *getenv();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10787
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10788
    char *name = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10789
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10790
    if (firstCall) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10791
	DWORD nameSize = sizeof(cachedName);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10792
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10793
	if (GetUserName(cachedName, &nameSize) == TRUE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10794
	    name = cachedName;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10795
	    firstCall = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10796
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10797
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10798
	name = cachedName;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10799
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10800
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10801
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10802
     * try a few common environment variables ...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10803
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10804
    if (! name || (name[0] == 0) ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10805
	name = getenv("LOGIN");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10806
	if (! name || (name[0] == 0) ) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10807
	    name = getenv("LOGNAME");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10808
	    if (! name || (name[0] == 0) ) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10809
		name = getenv("USER");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10810
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10811
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10812
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10813
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10814
     * nope - I really font know who you are.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10815
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10816
    if (! name || (name[0] == 0) ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10817
	name = "you";
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10818
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10819
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10820
    RETURN ( __MKSTRING(name) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10821
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10822
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10823
     OperatingSystem getLoginName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10824
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10825
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10826
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10827
getUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10828
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10829
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10830
    "return the current users (thats you) numeric user id"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10831
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10832
    ^ 1 "just a dummy for systems which do not have userIDs"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10833
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10834
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10835
     OperatingSystem getUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10836
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10837
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10838
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10839
getUserNameFromID:aNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10840
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10841
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10842
    "return the user-name-string for a given numeric user-id.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10843
     This is the login name, not the fullName."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10844
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10845
    aNumber == self getUserID ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10846
	^ self getLoginName
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10847
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10848
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10849
    ^ '? (' , aNumber printString , ')'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10850
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
     OperatingSystem getUserNameFromID:0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10853
     OperatingSystem getUserNameFromID:100
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 10854
     OperatingSystem getUserNameFromID:9991
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10855
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10856
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10857
15874
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 10858
isRunningWithElevatedRootOrAdminRights
15873
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10859
    "return true, if a NORMAL user is running with elevated admin rights."
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10860
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10861
%{
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10862
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10863
    HANDLE h_Process;
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10864
    HANDLE h_Token;
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10865
    TOKEN_ELEVATION t_TokenElevation;
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10866
    TOKEN_ELEVATION_TYPE e_ElevationType;
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10867
    DWORD dw_TokenLength;
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10868
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10869
    h_Process = GetCurrentProcess();
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10870
    if (OpenProcessToken(h_Process,TOKEN_READ,&h_Token) == FALSE) {
15877
a752f474d7a2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15874
diff changeset
 10871
	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
 10872
	goto getOutOfHere;
15873
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10873
    }
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10874
    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
 10875
	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
 10876
	CloseHandle(h_Token);
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 10877
	goto getOutOfHere;
15873
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10878
    }
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10879
    if (t_TokenElevation.TokenIsElevated != 0) {
15874
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 10880
	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
 10881
	    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
 10882
	    CloseHandle(h_Token);
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 10883
	    goto getOutOfHere;
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 10884
	} else {
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 10885
	    if (e_ElevationType == TokenElevationTypeFull || e_ElevationType == TokenElevationTypeDefault) {
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 10886
		CloseHandle(h_Token);
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 10887
		RETURN(true);
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 10888
	    }
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 10889
	    CloseHandle(h_Token);
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 10890
	    RETURN(false);
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 10891
	}
15873
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10892
    } else {
15874
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 10893
	CloseHandle(h_Token);
9441ca0da881 renamed isRunningWithElevatedAdminRights to isRunningWithElevatedRootOrAdminRights
Claus Gittinger <cg@exept.de>
parents: 15873
diff changeset
 10894
	RETURN(false);
15873
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10895
    }
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10896
getOutOfHere: ;
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10897
%}.
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10898
    "/ self primitiveFailed.
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10899
    ^ false
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10900
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10901
    "Modified: / 17-12-2013 / 17:12:23 / cg"
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10902
!
6871784b7a5b class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15871
diff changeset
 10903
15833
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 10904
isRunningWithRootOrAdminRights
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 10905
    "read some registry entry which only Admin can read;
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 10906
     if we can, we are; otherwise, we are not."
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 10907
15834
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 10908
%{
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 10909
    SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 10910
    PSID AdministratorsGroup;
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 10911
    BOOL IsInAdminGroup = FALSE;
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 10912
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 10913
    // Initialize SID.
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 10914
    if( !AllocateAndInitializeSid( &NtAuthority,
15870
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 10915
				   2,
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 10916
				   SECURITY_BUILTIN_DOMAIN_RID,
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 10917
				   DOMAIN_ALIAS_RID_ADMINS,
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 10918
				   0, 0, 0, 0, 0, 0,
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 10919
				   &AdministratorsGroup))
15834
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 10920
    {
15870
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 10921
	// Initializing SID Failed.
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 10922
	RETURN( false );
15834
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 10923
    }
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 10924
    // Check whether the token is present in admin group.
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 10925
    if( !CheckTokenMembership( NULL,
15870
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 10926
			       AdministratorsGroup,
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 10927
			       &IsInAdminGroup ))
15834
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 10928
    {
15870
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 10929
	// Error occurred.
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 10930
	IsInAdminGroup = FALSE;
15834
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 10931
    }
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 10932
    // Free SID and return.
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 10933
    FreeSid(AdministratorsGroup);
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 10934
    RETURN( IsInAdminGroup ? true : false);
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 10935
%}.
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 10936
    "/ seems not to work...
9aaea5f09ee7 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15833
diff changeset
 10937
15870
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 10938
"/    "/ RegOpenKey(HKEY_USERS, "S-1-5-19", &key)
15835
266f6ab9cdb2 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15834
diff changeset
 10939
"/    (RegistryEntry key:'HKEY_USERS') notNil ifTrue:[
266f6ab9cdb2 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15834
diff changeset
 10940
"/        (RegistryEntry key:'HKEY_USERS/S-1-5-19') notNil ifTrue:[
266f6ab9cdb2 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15834
diff changeset
 10941
"/            ^ true
266f6ab9cdb2 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15834
diff changeset
 10942
"/        ]
266f6ab9cdb2 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15834
diff changeset
 10943
"/    ].
15833
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 10944
    ^ false.
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 10945
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 10946
    "
15870
dc9e47f7ec47 added isRunningWithElevatedAdminRights
Claus Gittinger <cg@exept.de>
parents: 15835
diff changeset
 10947
     OperatingSystem isRunningWithRootOrAdminRights
15833
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 10948
    "
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 10949
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 10950
    "Created: / 28-11-2013 / 14:00:02 / cg"
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 10951
!
8131c0b10c98 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15816
diff changeset
 10952
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10953
userInfoOf:aNameOrID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10954
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10955
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10956
    "return a dictionary filled with userinfo. The argument can be either
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10957
     a string with the users name or its numeric id.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10958
     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
 10959
     Portable applications may want to check the systemType and NOT depend
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10960
     on all keys to be present in the returned dictionary."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10961
8659
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
 10962
    |info name "uid gid" dir|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10963
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10964
    info := IdentityDictionary new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10965
    name isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10966
	aNameOrID == self getUserID ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10967
	    name := self getLoginName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10968
	].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10969
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10970
    name notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10971
	info at:#name put:name.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10972
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10973
	info at:#name put:'unknown'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10974
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10975
    dir isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10976
	aNameOrID == self getUserID ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10977
	    dir := self getHomeDirectory
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 10978
	]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10979
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10980
    dir notNil ifTrue:[info at:#dir put:dir].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10981
    "/ uid notNil ifTrue:[info at:#uid put:uid].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10982
    "/ gid  notNil ifTrue:[info at:#gid put:gid].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10983
    ^ info
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10984
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10985
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10986
     OperatingSystem userInfoOf:'root'
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 10987
     OperatingSystem userInfoOf:1
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 10988
     OperatingSystem userInfoOf:'claus'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 10989
     OperatingSystem userInfoOf:'fooBar'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10990
     OperatingSystem userInfoOf:(OperatingSystem getUserID)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10991
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10992
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10993
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10994
!Win32OperatingSystem class methodsFor:'waiting for events'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10995
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10996
blockingChildProcessWait
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10997
     "return true, if childProcessWait: blocks, if no children are ready.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 10998
      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
 10999
      a subprocesses status (to avoid blocking)."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11000
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11001
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11002
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11003
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11004
childProcessWait:blocking pid:pidToWait
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11005
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11006
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11007
    "get status changes from child processes.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11008
     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
 11009
     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
 11010
     otherwise we return immediately.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 11011
     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
 11012
     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
 11013
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11014
    |pid status code core|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11015
%{
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 11016
    int endStatus;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11017
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
 11018
    if (__isExternalAddressLike(pidToWait) ) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11019
	HANDLE __pidToWait = _HANDLEVal(pidToWait);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11020
	int t;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11021
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
 11022
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11023
	console_printf("childProcessWait %x b %d\n",__pidToWait,blocking==true);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11024
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11025
	t = (blocking==true) ? INFINITE : 0;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11026
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11027
#ifdef DO_WRAP_CALLS
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11028
	if (t == 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11029
	    /* no need for WRAP-call; does not block */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11030
	    endStatus = WaitForSingleObject(__pidToWait, t);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11031
	    if (endStatus < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11032
		__threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11033
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11034
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11035
	    do {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11036
		__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
 11037
		// do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11038
		endStatus = STX_API_CALL2( "WaitForSingleObject", WaitForSingleObject, __pidToWait, t);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11039
	    } while ((endStatus < 0) && (__threadErrno == EINTR));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11040
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11041
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11042
	endStatus = WaitForSingleObject(__pidToWait, t);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11043
	if (endStatus < 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11044
	    __threadErrno = __WIN32_ERR(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11045
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11046
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11047
	if ( endStatus == WAIT_TIMEOUT ) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11048
	    if (blocking==true)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11049
		status = @symbol(timeout);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11050
	    else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11051
		status = @symbol(continue);
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
 11052
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11053
		console_printf("ret nil\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11054
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11055
		RETURN(nil);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11056
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11057
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11058
	    status = @symbol(exit);
12625
6b04dbbeb379 changed: #childProcessWait:pid:
Claus Gittinger <cg@exept.de>
parents: 12616
diff changeset
 11059
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11060
	    console_printf("exit\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11061
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11062
	    if (endStatus == WAIT_OBJECT_0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11063
		DWORD exitCode;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11064
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11065
		if (GetExitCodeProcess(__pidToWait, &exitCode)) {
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
 11066
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11067
		    console_printf("exitCode: %d\n", exitCode);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11068
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11069
		    if (exitCode == STILL_ACTIVE) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11070
			RETURN(nil);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11071
		    }
12625
6b04dbbeb379 changed: #childProcessWait:pid:
Claus Gittinger <cg@exept.de>
parents: 12616
diff changeset
 11072
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11073
		    console_printf("exit %d\n", exitCode);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11074
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11075
		    code = __mkSmallInteger(exitCode);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11076
		} else {
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
 11077
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11078
		    console_printf("GetExitCodeProcess failed\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11079
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11080
		    code = __mkSmallInteger(GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11081
		}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11082
	    } else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11083
		code = __mkSmallInteger(-1);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11084
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11085
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11086
	core = false;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11087
	pid = pidToWait;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11088
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11089
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11090
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11091
    (status isNil or:[pid isNil]) ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11092
	^ self primitiveFailed
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11093
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11094
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11095
"/ Transcript show:'pid: '; show:pid; show:' status: '; show:status;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11096
"/ show:' code: '; show:code; show:' core:'; showCR:core.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11097
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11098
    ^ OSProcessStatus pid:pid status:status code:code core:core
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11099
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11100
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11101
     OperatingSystem childProcessWait:false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11102
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11103
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11104
    "Created: 5.1.1996 / 16:39:14 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11105
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11106
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11107
numAvailableForReadOn:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11108
    "return the number of bytes available for reading, without blocking."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11109
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11110
    ^ (self readCheck:fd) ifTrue:[1] ifFalse:[0]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11111
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11112
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11113
selectOnAnyReadable:readFdArray writable:writeFdArray exception:exceptFdArray
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11114
  readableInto:readableResultFdArray writableInto:writableResultFdArray exceptionInto:exceptionResultFdArray
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11115
  withTimeOut:millis
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11116
    "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
 11117
     writeFdArray to become ready for writing,
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11118
     or exceptFdArray to arrive exceptional data (i.e. out-of-band data).
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11119
     Timeout after t milliseconds or - if the timeout time is 0 - immediately..
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11120
     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
 11121
     descriptors (i.e. to check if I/O possible without blocking).
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11122
     The corresponding filedescriptors which are ready are returned in readableResultFdArray,
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11123
     writableResultFdArray and exceptionResultFdArray respectively.
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11124
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11125
     Return the (overall) number of selected filedescriptors.
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11126
     readableResultFdArray, writableResultFdArray and exceptionResultFdArray will
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11127
     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
 11128
     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
 11129
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11130
%{
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11131
#define MAXHANDLE 128
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11132
    int i;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11133
    INT t;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11134
    OBJ fd, retFd;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11135
    int ret;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11136
    int numHandles = 0;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11137
    DWORD res;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11138
    HANDLE hArray[MAXHANDLE+1];
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11139
    int retArray[MAXHANDLE];
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11140
    int readCount, writeCount, exceptCount;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11141
    int resultSizeReadable, resultSizeWritable, resultSizeException;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11142
    int cntR = 0, cntW = 0, cntE = 0;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11143
    OBJ *__resultR, *__resultW, *__resultE;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11144
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11145
    if (readableResultFdArray != nil) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11146
        if (! __isArrayLike(readableResultFdArray)) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11147
            goto fail;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11148
        }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11149
        resultSizeReadable = __arraySize(readableResultFdArray);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11150
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11151
    if (writableResultFdArray != nil) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11152
        if (! __isArrayLike(writableResultFdArray)) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11153
            goto fail;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11154
        }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11155
        resultSizeWritable = __arraySize(writableResultFdArray);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11156
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11157
    if (exceptionResultFdArray != nil) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11158
        if (! __isArrayLike(exceptionResultFdArray)) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11159
            goto fail;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11160
        }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11161
        resultSizeException = __arraySize(exceptionResultFdArray);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11162
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11163
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11164
    if (__isNonNilObject(readFdArray)) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11165
        if (! __isArrayLike(readFdArray)) goto fail;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11166
        readCount = __arraySize(readFdArray);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11167
    } else {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11168
        readCount = 0;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11169
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11170
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11171
    if (__isNonNilObject(writeFdArray)) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11172
        if (! __isArrayLike(writeFdArray)) goto fail;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11173
        writeCount = __arraySize(writeFdArray);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11174
    } else {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11175
        writeCount = 0;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11176
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11177
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11178
    if (__isNonNilObject(exceptFdArray)) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11179
        if (! __isArrayLike(exceptFdArray)) goto fail;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11180
        exceptCount = __arraySize(exceptFdArray);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11181
    } else {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11182
        exceptCount = 0;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11183
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11184
    __resultR = __arrayVal(readableResultFdArray);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11185
    __resultW = __arrayVal(writableResultFdArray);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11186
    __resultE = __arrayVal(exceptionResultFdArray);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11187
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11188
    for (i = 0; (i < readCount) && (numHandles < MAXHANDLE); i++) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11189
        fd = __arrayVal(readFdArray)[i];
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11190
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11191
        if (fd != nil) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11192
            if (__isExternalAddressLike(fd)) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11193
                hArray  [numHandles] = _HANDLEVal(fd);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11194
                retArray[numHandles] = i;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11195
                ++numHandles;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11196
            } else {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11197
                int canRead = _canReadWithoutBlocking (__intVal(fd) );
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11198
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11199
                if (canRead > 0 ) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11200
                    if (cntR < resultSizeReadable) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11201
                        __resultR[cntR] = fd;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11202
                    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11203
                    cntR++;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11204
                } else {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11205
                    if (canRead < 0 ) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11206
                        @global(LastErrorNumber) = __mkSmallInteger(EBADF);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11207
                        RETURN (__mkSmallInteger(-1));
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11208
                    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11209
                }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11210
            }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11211
        }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11212
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11213
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11214
    for (i = 0; (i < writeCount) && (numHandles < MAXHANDLE);i++) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11215
        fd = __arrayVal(writeFdArray)[i];
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11216
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11217
        if (fd != nil) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11218
            if (__isExternalAddressLike(fd)) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11219
                hArray  [numHandles] = _HANDLEVal(fd);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11220
                retArray[numHandles] = i + 10000;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11221
                ++numHandles;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11222
            } else {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11223
                int canWrite = _canWriteWithoutBlocking (__intVal(fd) );
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11224
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11225
                if (canWrite > 0 ) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11226
                    if (cntW < resultSizeWritable) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11227
                        __resultW[cntW] = fd;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11228
                    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11229
                    cntW++;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11230
                } else {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11231
                    if (canWrite < 0 ) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11232
                        @global(LastErrorNumber) = __mkSmallInteger(EBADF);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11233
                        RETURN (__mkSmallInteger(-1));
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11234
                    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11235
                }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11236
            }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11237
        }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11238
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11239
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11240
    for (i = 0; (i < exceptCount) && (numHandles < MAXHANDLE);i++) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11241
        fd = __arrayVal(exceptFdArray)[i];
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11242
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11243
        if (fd != nil) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11244
            if (__isExternalAddressLike(fd)) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11245
                hArray  [numHandles] = _HANDLEVal(fd);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11246
                retArray[numHandles] = i + 20000;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11247
                ++numHandles;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11248
            }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11249
        }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11250
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11251
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11252
    if (cntR || cntW) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11253
        // for now: we are done
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11254
        RETURN(__mkSmallInteger(cntR+cntW+cntE));
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11255
        // maybe later: check for other handles immediately
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11256
        t = 0;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11257
    } else {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11258
        if (__isSmallInteger(millis)) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11259
            t = __intVal(millis);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11260
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11261
            if (t <= 0 && numHandles == 0) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11262
                RETURN (__mkSmallInteger(0));
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11263
            }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11264
        } else {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11265
            t = INFINITE;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11266
        }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11267
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11268
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11269
#ifdef SELECT3DEBUGWIN32
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11270
    console_printf("wait Handles = %d timeout = %d\n",numHandles, t);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11271
#endif
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11272
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11273
    res = __vmWait(numHandles, hArray, MAXHANDLE, t);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11274
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11275
    // refetch possibly moved pointers after wait
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11276
    __resultR = __arrayVal(readableResultFdArray);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11277
    __resultW = __arrayVal(writableResultFdArray);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11278
    __resultE = __arrayVal(exceptionResultFdArray);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11279
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11280
    if (numHandles) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11281
        if (res == WAIT_FAILED) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11282
#ifdef SELECT2DEBUGWIN32
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11283
            console_printf("- error %d; ret nil\n",GetLastError());
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11284
#endif
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11285
            if (__threadErrno == EINTR) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11286
                @global(LastErrorNumber) = nil;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11287
                RETURN (__mkSmallInteger(0));
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11288
            } else {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11289
                if (@global(InfoPrinting) == true) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11290
                    console_fprintf(stderr, "Win32OS [info]: select errno = %d\n", __threadErrno);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11291
                }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11292
                @global(LastErrorNumber) = __mkSmallInteger(EBADF);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11293
                RETURN (__mkSmallInteger(-1));
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11294
            }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11295
        }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11296
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11297
        if (res == WAIT_TIMEOUT) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11298
#ifdef SELECT3DEBUGWIN32
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11299
            console_printf("- timeOut; ret nil\n" );
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11300
#endif
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11301
            goto polling;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11302
        }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11303
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11304
        if (res == numHandles) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11305
            if (1 /* @global(InfoPrinting) == true */) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11306
                console_fprintf(stderr, "Win32OS [info]: plugIn event has been handled\n");
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11307
            }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11308
            goto done;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11309
        }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11310
        if ((res < 0) || (res > numHandles)) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11311
#ifdef SELECTDEBUGWIN32
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11312
            console_printf("- res=%d error1 %d\n", res, GetLastError());
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11313
#endif
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11314
            goto done;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11315
        }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11316
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11317
        ret = res;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11318
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11319
        if (ret < numHandles) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11320
            int fd = retArray[ret];
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11321
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11322
            @global(LastErrorNumber) = nil;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11323
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11324
#ifdef SELECTDEBUGWIN32
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11325
            if (ret) console_printf("wait Handles %d %d ret\n", ret, fd);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11326
#endif
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11327
            if (fd < 10000) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11328
                if (cntR < resultSizeReadable) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11329
                    OBJ temp = __arrayVal(readFdArray)[fd];
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11330
                    __resultR[cntR] = temp;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11331
                    __STORE(readableResultFdArray, temp);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11332
                }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11333
                cntR++;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11334
            }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11335
            if (fd < 20000) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11336
                if (cntW < resultSizeWritable) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11337
                    OBJ temp = __arrayVal(writeFdArray)[fd-10000];
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11338
                    __resultW[cntW] = temp;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11339
                    __STORE(writableResultFdArray, temp);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11340
                }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11341
                cntW++;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11342
            }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11343
            if (cntE < resultSizeException) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11344
                OBJ temp = __arrayVal(exceptFdArray)[fd-20000];
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11345
                __resultE[cntE] = temp;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11346
                __STORE(exceptionResultFdArray, temp);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11347
            }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11348
            cntE++;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11349
        }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11350
        console_fprintf(stderr, "Win32OS [info]: wait Handles ret = %d error2 %d\n", ret, GetLastError());
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11351
        goto fail;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11352
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11353
    if (t == 0) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11354
        // if we did not wait, there is no need to check again
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11355
        goto done;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11356
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11357
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11358
polling:
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11359
    for (i=0; i < readCount; i++) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11360
        fd = __arrayVal(readFdArray)[i];
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11361
        if (fd != nil && ! __isExternalAddressLike(fd)) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11362
            int canRead = _canReadWithoutBlocking (__intVal(fd));
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11363
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11364
            if (canRead > 0 ) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11365
                if (cntR < resultSizeReadable) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11366
                    __resultR[cntR] = fd;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11367
                }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11368
                cntR++;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11369
            } else {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11370
                if (canRead < 0 ) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11371
                    @global(LastErrorNumber) = __mkSmallInteger(EBADF);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11372
                    RETURN (__mkSmallInteger(-1));
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11373
                }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11374
            }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11375
        }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11376
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11377
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11378
    for (i=0; i < writeCount;i++) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11379
        fd = __arrayVal(writeFdArray)[i];
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11380
        if (fd != nil && ! __isExternalAddressLike(fd)) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11381
            int canWrite = _canWriteWithoutBlocking (__intVal(fd));
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11382
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11383
            if (canWrite > 0 ) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11384
                if (cntW < resultSizeWritable) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11385
                    __resultW[cntW] = __mkSmallInteger(i);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11386
                }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11387
                cntW++;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11388
            } else {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11389
                if (canWrite < 0 ) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11390
                    @global(LastErrorNumber) = __mkSmallInteger(EBADF);
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11391
                    RETURN (__mkSmallInteger(-1));
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11392
                }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11393
            }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11394
        }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11395
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11396
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11397
done:
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11398
    /* add a delimiter */
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11399
    if (cntR < resultSizeReadable) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11400
        __resultR[cntR] = nil;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11401
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11402
    if (cntW < resultSizeWritable) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11403
        __resultW[cntW] = nil;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11404
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11405
    if (cntE < resultSizeException) {
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11406
        __resultE[cntE] = nil;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11407
    }
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11408
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11409
    @global(LastErrorNumber) = nil;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11410
    RETURN (__mkSmallInteger(cntR+cntW+cntE));
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11411
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11412
fail: ;
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11413
%}.
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11414
    "
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11415
     timeout argument not integer,
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11416
     or any fd-array nonNil and not an array
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11417
     or not supported by OS
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11418
    "
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11419
    ^ self primitiveFailed
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11420
!
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 11421
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11422
selectOnAnyReadable:readFdArray writable:writeFdArray exception:exceptFdArray withTimeOut:millis
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11423
    "wait for any fd in readFdArray (an Array of integers) to become ready for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11424
     reading, writeFdArray to become ready for writing, or exceptFdArray to
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11425
     arrive exceptional data (i.e. out-of-band data).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11426
     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
 11427
     Empty fd-sets will always wait. Zero time can be used to poll file-
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11428
     descriptors (i.e. to check if I/O possible without blocking).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11429
     Return first ready fd if I/O ok, nil if timed-out or interrupted."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11430
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
#define MAXHANDLE 128
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11433
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11434
    int i;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11435
    INT t;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11436
    OBJ fd, retFd;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11437
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11438
    int numHandles = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11439
    DWORD res;
7865
67ea99d5edcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7860
diff changeset
 11440
    HANDLE hArray[MAXHANDLE+1];
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11441
    int    retArray[MAXHANDLE];
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
 11442
    int    readCount;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
 11443
    int    writeCount;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
 11444
    int    exceptCount;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11445
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11446
    if (__isNonNilObject(readFdArray)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11447
	if (! __isArrayLike(readFdArray)) goto fail;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11448
	readCount = __arraySize(readFdArray);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
 11449
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11450
	readCount = 0;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11451
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11452
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11453
    if (__isNonNilObject(writeFdArray)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11454
	if (! __isArrayLike(writeFdArray)) goto fail;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11455
	writeCount = __arraySize(writeFdArray);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
 11456
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11457
	writeCount = 0;
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
 11458
    }
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 11459
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
 11460
    if (__isNonNilObject(exceptFdArray)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11461
	if (! __isArrayLike(exceptFdArray)) goto fail;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11462
	exceptCount = __arraySize(exceptFdArray);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
 11463
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11464
	exceptCount = 0;
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
 11465
    }
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
 11466
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
 11467
    for (i = 0; (i < readCount) && (numHandles < MAXHANDLE);i++) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11468
	fd = __ArrayInstPtr(readFdArray)->a_element[i];
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
	if (fd != nil) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11471
	    if (__isExternalAddressLike(fd)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11472
		hArray  [numHandles] = _HANDLEVal(fd);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11473
		retArray[numHandles] = i;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11474
		++numHandles;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11475
	    } else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11476
		int canRead = _canReadWithoutBlocking (__intVal(fd) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11477
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11478
		if (canRead > 0 ) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11479
		    RETURN (fd);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11480
		} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11481
		    if (canRead < 0 ) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11482
			@global(LastErrorNumber) = __mkSmallInteger(EBADF);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11483
			RETURN ( @symbol(error) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11484
		    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11485
		}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11486
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11487
	}
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
 11488
    }
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
 11489
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
 11490
    for (i = 0; (i < writeCount) && (numHandles < MAXHANDLE);i++) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11491
	fd = __ArrayInstPtr(writeFdArray)->a_element[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11492
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11493
	if (fd != nil) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11494
	    if (__isExternalAddressLike(fd)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11495
		hArray  [numHandles] = _HANDLEVal(fd);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11496
		retArray[numHandles] = i + 10000;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11497
		++numHandles;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11498
	    } else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11499
		int canWrite = _canWriteWithoutBlocking (__intVal(fd) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11500
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11501
		if (canWrite > 0 ) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11502
		    RETURN (fd);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11503
		} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11504
		    if (canWrite < 0 ) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11505
			@global(LastErrorNumber) = __mkSmallInteger(EBADF);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11506
			RETURN ( @symbol(error) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11507
		    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11508
		}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11509
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11510
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11511
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11512
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
 11513
    for (i = 0; (i < exceptCount) && (numHandles < MAXHANDLE);i++) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11514
	fd = __ArrayInstPtr(exceptFdArray)->a_element[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11515
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11516
	if (fd != nil) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11517
	    if (__isExternalAddressLike(fd)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11518
		hArray  [numHandles] = _HANDLEVal(fd);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11519
		retArray[numHandles] = i + 20000;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11520
		++numHandles;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11521
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11522
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11523
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11524
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11525
    if (__isSmallInteger(millis)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11526
	t = __intVal(millis);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11527
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11528
	if (t <= 0 && numHandles == 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11529
	    RETURN (nil);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11530
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11531
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11532
	t = INFINITE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11533
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11534
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
 11535
#ifdef SELECT3DEBUGWIN32
10352
f2e9bb8906db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10342
diff changeset
 11536
    console_printf("wait Handles = %d timeout = %d\n",numHandles, t);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
 11537
#endif
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
 11538
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
 11539
    res = __vmWait (numHandles, hArray, MAXHANDLE, t);
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
 11540
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11541
    if (numHandles) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11542
	if (res == WAIT_FAILED) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11543
#ifdef SELECT2DEBUGWIN32
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11544
	    console_printf("- error %d; ret nil\n",GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11545
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11546
	    if (__threadErrno == EINTR) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11547
		__threadErrno = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11548
		@global(LastErrorNumber) = nil;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11549
	    } else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11550
		__threadErrno = EBADF;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11551
		if (@global(InfoPrinting) == true) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11552
		    console_fprintf(stderr, "Win32OS [info]: select errno = %d\n", __threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11553
		}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11554
		@global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11555
		RETURN ( @symbol(error) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11556
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11557
	    RETURN ( nil );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11558
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11559
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11560
	if (res == WAIT_TIMEOUT) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11561
#ifdef SELECT3DEBUGWIN32
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11562
	    console_printf("- timeOut; ret nil\n" );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11563
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11564
	    goto polling;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11565
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11566
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11567
	if (res == numHandles) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11568
	    if (1 /* @global(InfoPrinting) == true */) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11569
		console_fprintf(stderr, "Win32OS [info]: plugIn event has been handled\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11570
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11571
	    __threadErrno = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11572
	    @global(LastErrorNumber) = nil;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11573
	    RETURN ( nil );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11574
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11575
	if ((res < 0) || (res > numHandles)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11576
#ifdef SELECTDEBUGWIN32
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11577
	    console_printf("- res=%d error1 %d\n", res, GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11578
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11579
	    __threadErrno = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11580
	    @global(LastErrorNumber) = nil;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11581
	    RETURN ( nil );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11582
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11583
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11584
	ret = res;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11585
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11586
	if (ret < numHandles) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11587
	    int fd = retArray[ret];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11588
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11589
	    @global(LastErrorNumber) = nil;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11590
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11591
#ifdef SELECTDEBUGWIN32
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11592
	    if (ret) console_printf("wait Handles %d %d ret\n", ret, fd);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11593
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11594
	    if (fd < 10000) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11595
		RETURN ( __ArrayInstPtr(readFdArray)->a_element[fd] );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11596
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11597
	    if (fd < 20000) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11598
		RETURN ( __ArrayInstPtr(writeFdArray)->a_element[fd-10000] );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11599
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11600
	    RETURN ( __ArrayInstPtr(exceptFdArray)->a_element[fd-20000] );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11601
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11602
	console_fprintf(stderr, "Win32OS [info]: wait Handles ret = %d error2 %d\n", ret, GetLastError());
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11603
	goto fail;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11604
    } else {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11605
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11606
polling:
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 11607
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11608
	for (i=0; i < readCount;i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11609
	    fd = __ArrayInstPtr(readFdArray)->a_element[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11610
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11611
	    if (fd != nil) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11612
		if (! __isExternalAddressLike(fd)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11613
		    int canRead = _canReadWithoutBlocking (__intVal(fd));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11614
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11615
		    if (canRead > 0 ) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11616
			RETURN (fd);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11617
		    } else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11618
			if (canRead < 0 ) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11619
			    @global(LastErrorNumber) = __mkSmallInteger(EBADF);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11620
			    RETURN ( @symbol(error) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11621
			}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11622
		    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11623
		}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11624
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11625
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11626
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11627
	for (i=0; i < writeCount;i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11628
	    fd = __ArrayInstPtr(writeFdArray)->a_element[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11629
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11630
	    if (fd != nil) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11631
		if (! __isExternalAddressLike(fd)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11632
		    int canWrite = _canWriteWithoutBlocking (__intVal(fd));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11633
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11634
		    if (canWrite > 0 ) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11635
			RETURN (fd);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11636
		    } else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11637
			if (canWrite < 0 ) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11638
			    @global(LastErrorNumber) = __mkSmallInteger(EBADF);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11639
			    RETURN ( @symbol(error) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11640
			}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11641
		    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11642
		}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11643
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11644
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11645
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11646
	@global(LastErrorNumber) = nil;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11647
	RETURN ( nil );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11648
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11649
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11650
fail: ;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11651
%}.
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
     timeout argument not integer,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11654
     or any fd-array nonNil and not an array
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11655
     or not supported by OS
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
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11658
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11659
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11660
setBlocking:aBoolean on:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11661
    "set/clear the blocking attribute - if set (which is the default)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11662
     a read on the fileDescriptor will block until data is available.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11663
     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
 11664
     nil.
6bc82606b914 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15877
diff changeset
 11665
6bc82606b914 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15877
diff changeset
 11666
     Ignored in windows. Windows calls operate in their own thread,
6bc82606b914 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15877
diff changeset
 11667
     so non-blocking mode doesn't make sense."
6bc82606b914 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15877
diff changeset
 11668
6bc82606b914 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15877
diff changeset
 11669
    ^ true 
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11670
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11671
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11672
waitForMultipleObjects:fdOrHandleArray withTimeout:millis
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11673
    "wait for an fd to become ready.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11674
     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
 11675
     Zero time can be used to poll a file-
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11676
     descriptors (i.e. to check if I/O possible without blocking).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11677
     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
 11678
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11679
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11680
#ifndef MAXHANDLE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11681
# define MAXHANDLE 128
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11682
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11683
    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
 11684
    int res;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11685
    HANDLE hArray[MAXHANDLE];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11686
    INT i, count;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11687
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8912
diff changeset
 11688
    if (! __isArrayLike(fdOrHandleArray)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11689
	goto fail;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11690
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11691
    count = __arraySize(fdOrHandleArray);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11692
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11693
    for (i=0; i<count; i++) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11694
	OBJ fdOrHandle = __ArrayInstPtr(fdOrHandleArray)->a_element[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11695
	HANDLE h;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11696
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11697
	if (__isExternalAddressLike(fdOrHandle)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11698
	    h = _HANDLEVal(fdOrHandle);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11699
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11700
	    if (__isSmallInteger(fdOrHandle)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11701
		h = (HANDLE) _get_osfhandle (__intVal(fdOrHandle));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11702
	    } else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11703
		goto fail;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11704
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11705
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11706
	hArray[i] = h;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11707
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11708
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11709
    if (__isSmallInteger(millis)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11710
	t = __intVal(millis);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11711
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11712
	t = INFINITE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11713
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11714
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11715
#ifdef DO_WRAP_CALLS
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 11716
    do {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11717
	__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
 11718
	// do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11719
	res = STX_API_CALL4( "WaitForMultipleObjects", WaitForMultipleObjects, count, hArray, FALSE, t);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11720
    } while ((res < 0) && (__threadErrno == EINTR));
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11721
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11722
    res = WaitForMultipleObjects(count, hArray, FALSE, t);
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
 11723
    if (res < 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11724
	__threadErrno = __WIN32_ERR(GetLastError());
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
 11725
    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11726
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11727
    if (res == WAIT_FAILED) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11728
	RETURN (nil);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11729
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11730
    if (res == WAIT_TIMEOUT) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11731
	RETURN (nil);
5133
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
    if ((res >= WAIT_OBJECT_0) && (res < (WAIT_OBJECT_0+count))) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11734
	RETURN (__ArrayInstPtr(fdOrHandleArray)->a_element[res-WAIT_OBJECT_0]);
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
    RETURN (nil);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11738
fail: ;
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
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11741
     invalid arg,
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
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11744
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11745
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11746
waitForSingleObject:fdOrHandle withTimeout:millis
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11747
    "wait for an fd to become ready.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11748
     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
 11749
     Zero time can be used to poll a file-
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11750
     descriptors (i.e. to check if I/O possible without blocking).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11751
     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
 11752
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11753
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11754
    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
 11755
    int res;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11756
    HANDLE h = NULL;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11757
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
 11758
    if (__isExternalAddressLike(fdOrHandle)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11759
	h = _HANDLEVal(fdOrHandle);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11760
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11761
	if (__isSmallInteger(fdOrHandle)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11762
	    h = (HANDLE) _get_osfhandle (__intVal(fdOrHandle));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11763
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11764
	    goto fail;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11765
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11766
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11767
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11768
    if (__isSmallInteger(millis)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11769
	t = __intVal(millis);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11770
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11771
	t = INFINITE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11772
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11773
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11774
#ifdef DO_WRAP_CALLS
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 11775
    do {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11776
	__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
 11777
	// do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11778
	res = STX_API_CALL2( "WaitForSingleObject", WaitForSingleObject, h,  t);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11779
    } while ((res < 0) && (__threadErrno == EINTR));
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11780
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11781
    res = WaitForSingleObject(h, t);
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
 11782
    if (res < 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11783
	__threadErrno = __WIN32_ERR(GetLastError());
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
 11784
    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11785
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11786
    if (res == WAIT_FAILED) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11787
	RETURN (nil);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11788
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11789
    if (res == WAIT_TIMEOUT) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11790
	RETURN (nil);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11791
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11792
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11793
    RETURN (fdOrHandle);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11794
fail: ;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11795
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11796
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11797
     invalid arg,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11798
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11799
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11800
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11801
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11802
!Win32OperatingSystem::DevModeStructure methodsFor:'accessing'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11803
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11804
bitsPerPel
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11805
    ^ self unsignedLongAt: 1+104
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11806
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11807
    "Created: / 27-07-2006 / 15:14:17 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11808
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11809
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11810
collate
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11811
    ^ self shortAt: 1+68
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11812
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11813
    "Created: / 01-08-2006 / 09:56:38 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11814
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11815
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11816
collate: n
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11817
    ^ self shortAt: 1+68 put: n
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11818
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11819
    "Created: / 01-08-2006 / 09:58:07 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11820
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11821
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11822
color
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11823
    ^ self shortAt: 1+60
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11824
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11825
    "Created: / 27-07-2006 / 15:31:25 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11826
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11827
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11828
copies
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11829
    ^ self shortAt: 1+54
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11830
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11831
    "Created: / 27-07-2006 / 15:30:52 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11832
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11833
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11834
copies: n
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11835
    ^ self shortAt: 1+54 put: n
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11836
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11837
    "Created: / 27-07-2006 / 15:36:39 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11838
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11839
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11840
deviceName
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11841
    ^ self stringAt: 1+0 size: 32
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11842
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11843
    "Created: / 27-07-2006 / 15:15:52 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11844
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11845
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11846
orientation
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11847
    ^ self shortAt: 1+44
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11848
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11849
    "Created: / 27-07-2006 / 15:34:57 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11850
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11851
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11852
orientation: orientationInt
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11853
    ^ self shortAt: 1+44 put: orientationInt
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11854
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11855
    "Created: / 27-07-2006 / 15:36:31 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11856
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11857
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11858
paperLength
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11859
    ^ self shortAt: 1+48
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11860
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11861
    "Created: / 27-07-2006 / 15:32:59 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11862
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11863
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11864
paperSize
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11865
    ^ self shortAt: 1+46
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11866
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11867
    "Created: / 27-07-2006 / 15:32:12 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11868
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11869
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11870
paperSize:funnyMSPaperSizeCode
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11871
    ^ self shortAt: 1+46 put: funnyMSPaperSizeCode
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11872
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11873
    "Created: / 27-07-2006 / 15:35:53 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11874
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11875
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11876
paperWidth
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11877
    ^ self shortAt: 1+50
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11878
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11879
    "Created: / 27-07-2006 / 15:32:25 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11880
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11881
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11882
printQuality
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11883
    ^ self shortAt: 1+58
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11884
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11885
    "Created: / 27-07-2006 / 15:33:58 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11886
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11887
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11888
printQuality: qualityInteger
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11889
    ^ self shortAt: 1+58 put: qualityInteger
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11890
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11891
    "Created: / 27-07-2006 / 15:36:20 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11892
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11893
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11894
scale
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11895
    ^ self shortAt: 1+52
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11896
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11897
    "Created: / 27-07-2006 / 15:33:31 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11898
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11899
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11900
scale: percent
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11901
    ^ self shortAt: 1+52 put: percent
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11902
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11903
    "Created: / 27-07-2006 / 15:36:05 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11904
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11905
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11906
!Win32OperatingSystem::DocInfoStructure class methodsFor:'instance creation'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11907
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11908
new
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11909
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11910
^super new: self sizeInBytes
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11911
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11912
    "Created: / 02-08-2006 / 16:21:01 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11913
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11914
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11915
sizeInBytes
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11916
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11917
^20
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11918
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11919
    "Created: / 02-08-2006 / 16:21:10 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11920
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11921
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11922
!Win32OperatingSystem::DocInfoStructure methodsFor:'accessing'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11923
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11924
cbSize
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11925
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11926
^self longAt: 0+1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11927
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11928
    "Created: / 28-07-2006 / 18:36:02 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11929
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11930
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11931
cbSize: aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11932
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11933
self longAt: 0+1 put: aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11934
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11935
    "Created: / 28-07-2006 / 18:37:25 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11936
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11937
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11938
fwType
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11939
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11940
^self longAt: 16+1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11941
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11942
    "Created: / 28-07-2006 / 18:37:44 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11943
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11944
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11945
fwType: aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11946
"Set a DWORD fwType"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11947
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11948
self longAt: 16+1 put:aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11949
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11950
    "Created: / 28-07-2006 / 18:38:17 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11951
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11952
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11953
lpszDocName
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11954
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11955
^(ExternalBytes address:(self unsignedLongAt: 4+1)) stringAt:1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11956
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11957
    "Created: / 03-08-2006 / 15:06:56 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11958
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11959
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11960
lpszDocName: aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11961
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11962
^self unsignedLongAt: 4+1 put: aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11963
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11964
    "Created: / 03-08-2006 / 15:08:32 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11965
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11966
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11967
lpszOutput
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11968
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11969
^(ExternalBytes address:(self unsignedLongAt: 8+1)) stringAt:1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11970
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11971
    "Created: / 03-08-2006 / 15:07:52 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11972
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11973
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11974
lpszOutput: aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11975
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11976
^self unsignedLongAt: 8+1 put: aValue
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11977
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11978
    "Created: / 03-08-2006 / 15:08:49 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11979
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 11980
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 11981
!Win32OperatingSystem::FileStatusInfo class methodsFor:'instance creation'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 11982
11258
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 11983
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
 11984
    ^ self basicNew
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11985
	type:t mode:m uid:u gid:g size:s
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11986
	id:i accessed:aT modified:mT created:cT
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11987
	sourcePath:lP
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11988
	fullName:fullName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 11989
	alternativeName:name2
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 11990
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 11991
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 11992
!Win32OperatingSystem::FileStatusInfo methodsFor:'accessing'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 11993
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 11994
accessTime
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 11995
    "return accessed"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 11996
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 11997
    ^ accessed
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 11998
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 11999
    "Created: / 1.2.2002 / 11:05:49 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12000
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12001
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12002
alternativeName
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12003
    "return the files other name (DOS name on windows).
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12004
     Nil if there is no other name"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12005
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12006
    |path idx|
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12007
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12008
    path := self alternativePathName.
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12009
    path notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12010
	idx := path lastIndexOf:$\ startingAt:path size-1.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12011
	idx ~~ 0 ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12012
	    path := path copyFrom:(idx+1).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12013
	].
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12014
    ].
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12015
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12016
    ^ path
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12017
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12018
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12019
	'C:\' asFilename info alternativeName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12020
	'C:\Dokumente und Einstellungen\' asFilename info alternativeName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12021
	'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
 12022
    "
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12023
!
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12024
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12025
alternativePathName
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12026
    "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
 12027
     Nil if there is no other name"
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12028
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12029
    "/ access lazily...
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12030
    alternativePathName isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12031
	alternativePathName := (OperatingSystem getShortPathName:sourcePath) asSingleByteString.
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12032
    ].
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12033
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12034
    ^ alternativePathName
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12035
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12036
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12037
	'C:\' asFilename info alternativePathName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12038
	'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
 12039
    "
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12040
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12041
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12042
creationTime
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12043
    ^ created
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12044
!
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12045
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12046
fileSize
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12047
    "return size"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12048
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12049
    ^ size
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12050
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12051
    "Created: / 1.2.2002 / 11:06:15 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12052
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12053
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
 12054
fullName
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
 12055
    "return the files real name (non-DOS name on windows).
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
 12056
     Nil if there is no other name"
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
 12057
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12058
    |path idx|
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12059
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12060
    path := self fullPathName.
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12061
    path notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12062
	idx := path lastIndexOf:$\ startingAt:path size-1.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12063
	idx ~~ 0 ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12064
	    path := path copyFrom:(idx+1).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12065
	].
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12066
    ].
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12067
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12068
    ^ path
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12069
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12070
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12071
	'\' asFilename info fullName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12072
	'C:\' asFilename info fullName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12073
	'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
 12074
    "
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12075
!
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12076
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12077
fullPathName
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12078
    "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
 12079
     Nil if there is no other name"
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12080
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12081
    "/ access lazily...
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12082
    fullPathName isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12083
	fullPathName := (OperatingSystem getLongPathName:sourcePath) asSingleByteStringIfPossible.
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12084
    ].
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12085
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12086
    ^ fullPathName
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12087
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12088
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12089
	'C:\' asFilename info fullPathName
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12090
	'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
 12091
    "
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
 12092
!
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
 12093
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12094
gid
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12095
    "return gid"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12096
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12097
    ^ gid
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12098
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12099
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12100
id
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12101
    "return id"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12102
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12103
    ^ id
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12104
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12105
11258
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12106
linkTargetPath
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12107
    "for symbolic links only: return the path where the symbolic link points to"
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12108
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12109
    "/ access lazily...
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12110
    linkTargetPath isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12111
	type == #symbolicLink ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12112
	    linkTargetPath := OperatingSystem getLinkTarget:sourcePath.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12113
	]
11258
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12114
    ].
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12115
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12116
    ^ linkTargetPath
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12117
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12118
    "Modified: / 07-02-2007 / 10:31:56 / cg"
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12119
!
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12120
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12121
mode
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12122
    "return mode"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12123
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12124
    ^ mode
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12125
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12126
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12127
modificationTime
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12128
    "return modified"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12129
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12130
    ^ modified
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12131
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12132
    "Created: / 1.2.2002 / 11:06:33 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12133
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12134
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12135
numLinks
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12136
    "DOS has no hardLinks - return 1"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12137
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12138
    ^ 1
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12139
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12140
    "Created: / 1.2.2002 / 11:07:04 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12141
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12142
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12143
path
11258
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12144
    "for symbolic links only: return the path where the symbolic link points to.
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12145
     bad named method - left here for backward compatibility"
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12146
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12147
    ^ self linkTargetPath.
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12148
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12149
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12150
size
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12151
    "return size"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12152
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12153
    ^ size
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12154
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12155
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12156
statusChangeTime
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12157
    "return statusChanged"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12158
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12159
    ^ statusChanged ? modified
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12160
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12161
    "Created: / 1.2.2002 / 11:07:27 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12162
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
 12163
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12164
type
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12165
    "return type"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12166
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12167
    ^ type
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12168
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12169
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12170
uid
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12171
    "return uid"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12172
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12173
    ^ uid
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12174
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12175
10585
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12176
!Win32OperatingSystem::FileStatusInfo methodsFor:'accessing-vms'!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12177
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12178
fixedHeaderSize
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12179
    "return the fixedHeaderSize (VMS only; nil everywhere else)"
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12180
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12181
    ^ nil
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12182
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12183
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12184
recordAttributes
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12185
    "return the recordAttributes (VMS only; nil everywhere else)"
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12186
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12187
    ^ nil
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12188
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12189
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12190
recordFormat
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12191
    "return the recordFormat (VMS only; nil everywhere else)"
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12192
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12193
    ^ nil
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12194
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12195
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12196
recordFormatNumeric
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12197
    "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
 12198
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12199
    ^ nil
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12200
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12201
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12202
recordSize
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12203
    "return the recordSize (VMS only; nil everywhere else)"
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12204
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12205
    ^ nil
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12206
! !
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12207
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12208
!Win32OperatingSystem::FileStatusInfo methodsFor:'backward compatibility'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12209
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12210
accessed
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12211
    "return accessed"
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12212
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12213
    <resource: #obsolete>
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12214
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12215
    self obsoleteMethodWarning:'use #accessTime'.
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12216
    ^ accessed
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12217
!
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12218
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12219
at:key
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12220
    "backward compatibility access: in previous releases, IdentityDictionaries
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12221
     were used to hold my information. Allow access via key messages.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12222
     This method will vanish - use the proper access protocol."
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12223
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12224
    ^ self perform:key
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12225
!
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12226
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12227
modified
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12228
    <resource: #obsolete>
9061
20af48b9b295 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9026
diff changeset
 12229
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12230
    self obsoleteMethodWarning:'use #modificationTime'.
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12231
    ^ modified
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12232
!
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12233
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12234
statusChanged
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12235
    <resource: #obsolete>
9061
20af48b9b295 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9026
diff changeset
 12236
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12237
    self obsoleteMethodWarning:'use #statusChangeTime'.
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12238
    ^ statusChanged
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12239
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12240
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12241
!Win32OperatingSystem::FileStatusInfo methodsFor:'private accessing'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12242
11258
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12243
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
 12244
    type := t.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12245
    mode := m.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12246
    uid := u.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12247
    gid := g.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12248
    size := s.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12249
    id := i.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12250
    accessed := aT.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12251
    modified := mT.
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 12252
    created := cT.
11258
5117e5bd0dc3 symbolic link name resolution
ca
parents: 11253
diff changeset
 12253
    sourcePath := lP.
11804
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12254
    fullPathName := name1.
2596279cafb6 Speed up #linkInfoOf: (especially on networked files)
Stefan Vogel <sv@exept.de>
parents: 11800
diff changeset
 12255
    alternativePathName := name2.
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12256
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12257
10585
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12258
!Win32OperatingSystem::FileStatusInfo methodsFor:'queries-access'!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12259
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12260
isGroupExecutable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12261
    ^ mode bitTest:8r10
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12262
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12263
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12264
      'smalltalk.rc' asFilename info isGroupExecutable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12265
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12266
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12267
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12268
isGroupReadable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12269
    ^ mode bitTest:8r40
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12270
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12271
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12272
      'smalltalk.rc' asFilename info isGroupReadable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12273
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12274
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12275
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12276
isGroupWritable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12277
    ^ mode bitTest:8r20
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12278
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12279
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12280
      'smalltalk.rc' asFilename info isGroupWritable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12281
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12282
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12283
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12284
isOwnerExecutable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12285
    ^ mode bitTest:8r100
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12286
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12287
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12288
      'smalltalk.rc' asFilename info isOwnerExecutable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12289
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12290
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12291
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12292
isOwnerReadable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12293
    ^ mode bitTest:8r400
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12294
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12295
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12296
      'smalltalk.rc' asFilename info isOwnerReadable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12297
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12298
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12299
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12300
isOwnerWritable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12301
    ^ mode bitTest:8r200
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12302
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12303
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12304
      'smalltalk.rc' asFilename info isOwnerWritable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12305
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12306
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12307
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12308
isWorldExecutable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12309
    ^ mode bitTest:8r1
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12310
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12311
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12312
      'smalltalk.rc' asFilename info isWorldExecutable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12313
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12314
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12315
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12316
isWorldReadable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12317
    ^ mode bitTest:8r4
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12318
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12319
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12320
      'smalltalk.rc' asFilename info isWorldReadable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12321
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12322
!
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12323
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12324
isWorldWritable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12325
    ^ mode bitTest:8r2
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12326
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12327
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12328
      'smalltalk.rc' asFilename info isWorldWritable
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12329
    "
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12330
! !
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12331
ecf3a579f2af FileStatusInfo - methods to check access rights
Stefan Vogel <sv@exept.de>
parents: 10543
diff changeset
 12332
!Win32OperatingSystem::FileStatusInfo methodsFor:'queries-type'!
6799
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12333
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12334
isBlockSpecial
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12335
    ^ type == #characterSpecial
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12336
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12337
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12338
isCharacterSpecial
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12339
    ^ type == #characterSpecial
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12340
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12341
6799
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12342
isDirectory
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12343
    ^ type == #directory
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12344
!
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12345
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12346
isFifo
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12347
    ^ type == #fifo
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12348
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12349
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12350
isRegular
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12351
    ^ type == #regular
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12352
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12353
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12354
isSocket
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12355
    ^ type == #socket
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12356
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12357
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
 12358
isSpecialFile
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
 12359
    ^ (type ~~ #directory
15339
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
 12360
	and:[type ~~ #remoteDirectory
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
 12361
	and:[type ~~ #regular
c701f431b3f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15338
diff changeset
 12362
	and:[type ~~ #symbolicLink
15252
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
 12363
    ]]])
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
 12364
!
621c034e94a0 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15177
diff changeset
 12365
6799
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12366
isSymbolicLink
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12367
    ^ 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
 12368
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12369
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12370
isUnknown
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
 12371
    ^ type == #unknown
6799
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12372
! !
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
 12373
9155
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 12374
!Win32OperatingSystem::OSProcessStatus class methodsFor:'documentation'!
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 12375
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12376
documentation
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12377
"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12378
    This is an auxillary class, that holds information about status changes of
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12379
    operating system processes (these are no smalltalk processes!!).
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12380
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12381
    [Instance variables:]
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12382
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12383
	pid     <Integer>       OS-Process identifier
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12384
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12385
	status  <Symbol>        either #exit #signal #stop #continue
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12386
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12387
	code    <Integer>       either exitcode or signalnumber
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12388
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12389
	core    <Boolean>       true if core has been dumped
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12390
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12391
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12392
    [author:]
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12393
	Stefan Vogel
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12394
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12395
    [see also:]
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12396
	OperatingSystem
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12397
"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12398
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12399
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12400
!Win32OperatingSystem::OSProcessStatus class methodsFor:'instance creation'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12401
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12402
pid:pid status:status code:code core:core
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12403
    "private interface for Win32OperatingSystem"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12404
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12405
    ^ self new pid:pid status:status code:code core:core
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12406
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12407
    "Created: 28.12.1995 / 14:16:14 / stefan"
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12408
    "Modified: 30.4.1996 / 18:25:00 / cg"
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12409
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12410
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12411
processCreationFailure
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12412
    "private interface for Win32OperatingSystem"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12413
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12414
    ^ self new pid:-1 status:#failure code:-1 core:false
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12415
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12416
    "Created: 28.12.1995 / 14:35:29 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12417
    "Modified: 30.4.1996 / 18:25:05 / cg"
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12418
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12419
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12420
!Win32OperatingSystem::OSProcessStatus methodsFor:'accessing'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12421
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12422
code
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12423
    "return the exitcode / signalNumber"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12424
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12425
    ^ code
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12426
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12427
    "Created: 28.12.1995 / 14:05:07 / stefan"
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12428
    "Modified: 30.4.1996 / 18:26:23 / cg"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12429
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12430
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12431
core
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12432
    "return true if core has been dumped, false otherwise"
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12433
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12434
    ^ core == true
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12435
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12436
    "Modified: 28.12.1995 / 14:14:38 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12437
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12438
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12439
pid
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12440
    "return the pid"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12441
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12442
    ^ pid
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12443
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12444
    "Created: 28.12.1995 / 14:05:07 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12445
    "Modified: 30.4.1996 / 18:26:30 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12446
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12447
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12448
status
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12449
    "return status as a Symbol;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12450
     one of #exit #signal #stop #continue"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12451
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12452
    ^ status
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12453
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12454
    "Created: 28.12.1995 / 14:05:07 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12455
    "Modified: 30.4.1996 / 18:26:54 / cg"
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12456
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12457
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12458
!Win32OperatingSystem::OSProcessStatus methodsFor:'initialization'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12459
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12460
pid:newPid status:newStatus code:newCode core:newCore
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12461
    pid := newPid.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12462
    status := newStatus.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12463
    code := newCode.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12464
    core := newCore.
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12465
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12466
    "Created: 28.12.1995 / 14:18:22 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12467
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
 12468
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12469
!Win32OperatingSystem::OSProcessStatus methodsFor:'private-OS interface'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12470
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12471
code:something
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12472
    "set the exitCode"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12473
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12474
    code := something.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12475
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12476
    "Created: 28.12.1995 / 14:05:07 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12477
    "Modified: 30.4.1996 / 18:25:18 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12478
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12479
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12480
core:something
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12481
    "set core"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12482
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12483
    core := something.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12484
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12485
    "Created: 28.12.1995 / 14:05:07 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12486
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12487
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12488
pid:something
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12489
    "set pid"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12490
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12491
    pid := something.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12492
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12493
    "Created: 28.12.1995 / 14:05:07 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12494
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12495
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12496
status:something
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12497
    "set status"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12498
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12499
    status := something.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12500
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12501
    "Created: 28.12.1995 / 14:05:07 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12502
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12503
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12504
!Win32OperatingSystem::OSProcessStatus methodsFor:'queries'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12505
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12506
couldNotExecute
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12507
    "return true when a command could not be executed"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12508
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12509
    ^ status == #exit and:[code = 127].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12510
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12511
    "Created: 28.12.1995 / 15:43:17 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12512
    "Modified: 30.4.1996 / 18:27:03 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12513
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12514
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12515
stillAlive
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12516
    "true if process is still alive"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12517
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12518
    ^ status == #stop or:[status == #continue]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12519
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12520
    "Created: 28.12.1995 / 14:27:26 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12521
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12522
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12523
success
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12524
    "true if process terminated successfully"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12525
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12526
    ^ status == #exit and:[code = 0]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12527
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12528
    "Created: 28.12.1995 / 14:13:05 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12529
    "Modified: 28.12.1995 / 14:13:41 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12530
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 12531
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12532
!Win32OperatingSystem::PerformanceData class methodsFor:'accessing'!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12533
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12534
counterIndexTextDictionary
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12535
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12536
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12537
	self counterIndexTextDictionary
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12538
    "
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12539
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12540
    CounterIndexTextDictionary isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12541
	self synchronized:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12542
	    CounterIndexTextDictionary isNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12543
		|performanceText counterIndexTextDictionary|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12544
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12545
		performanceText := self getPerformanceText valueNamed:'Counter'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12546
		counterIndexTextDictionary := IdentityDictionary new.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12547
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12548
		1 to:performanceText size by:2 do:[:index|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12549
		    counterIndexTextDictionary at:(performanceText at:index) asInteger put:(performanceText at:index + 1).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12550
		].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12551
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12552
		CounterIndexTextDictionary := counterIndexTextDictionary.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12553
	    ].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12554
	].
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12555
    ].
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12556
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12557
    ^ CounterIndexTextDictionary
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12558
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12559
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12560
helpIndexTextDictionary
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12561
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12562
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12563
	self helpIndexTextDictionary
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12564
    "
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12565
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12566
    HelpIndexTextDictionary isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12567
	self synchronized:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12568
	    HelpIndexTextDictionary isNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12569
		|performanceText helpIndexTextDictionary|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12570
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12571
		performanceText := self getPerformanceText valueNamed:'Help'.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12572
		helpIndexTextDictionary := IdentityDictionary new.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12573
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12574
		1 to:performanceText size by:2 do:[:index|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12575
		    helpIndexTextDictionary at:(performanceText at:index) asInteger put:(performanceText at:index + 1).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12576
		].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12577
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12578
		HelpIndexTextDictionary := helpIndexTextDictionary.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12579
	    ].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12580
	].
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12581
    ].
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12582
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12583
    ^ HelpIndexTextDictionary
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12584
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12585
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12586
!Win32OperatingSystem::PerformanceData class methodsFor:'accessing subclasses'!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12587
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 12588
diskIO
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 12589
    ^ DiskIO current
10688
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
 12590
!
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
 12591
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12592
global
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 12593
    ^ Global current
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12594
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12595
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 12596
memory
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 12597
    ^ Memory current
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 12598
!
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 12599
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 12600
network
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 12601
    ^ Network current
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 12602
!
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 12603
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 12604
process
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 12605
    ^ Process current
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 12606
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 12607
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12608
processor
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 12609
    ^ Processor current
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12610
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12611
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12612
!Win32OperatingSystem::PerformanceData class methodsFor:'documentation'!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12613
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 12614
documentation
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 12615
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 12616
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12617
	VISTA:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12618
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 12619
	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
 12620
	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
 12621
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12622
	Um dies zu umgehen:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12623
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12624
	To turn off UAC
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12625
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12626
	1. Click Start, and then click Control Panel.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12627
	2. In Control Panel, click User Accounts.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12628
	3. In the User Accounts window, click User Accounts.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12629
	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
 12630
	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
 12631
	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
 12632
	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
 12633
    "
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 12634
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 12635
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12636
examples
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12637
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 12638
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12639
	######################################### PRIMITIVE
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12640
	self getUsedMemoryInPercentage.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12641
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12642
	self getPhysicalMemoryInKB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12643
	self getPhysicalMemoryInMB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12644
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12645
	self getFreePhysicalMemoryInKB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12646
	self getFreePhysicalMemoryInMB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12647
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12648
	self getPageFileSizeInKB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12649
	self getPageFileSizeInMB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12650
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12651
	self getFreePageFileSizeInKB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12652
	self getFreePageFileSizeInMB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12653
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12654
	self getVirtualMemoryInKB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12655
	self getVirtualMemoryInMB.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12656
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12657
	######################################### REGISTRY
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12658
	self helpIndexTextDictionary
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12659
	self counterIndexTextDictionary
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12660
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12661
	self global getCounterNameIndexArray.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12662
	self global getObjectNameIndexArray.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12663
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12664
	self processor getCounterNameIndexArray.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12665
	self processor processorUsage.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12666
	self processor processorUsageFromLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12667
	self processor interruptsPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12668
	self processor interruptsPerSecondFromLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12669
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12670
	self process getCounterNameIndexArray.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12671
	self process processUsage.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12672
	self process processUsageFromLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12673
	self process runningProcesses.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12674
	self process runningProcessNameList.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12675
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12676
	self network getCounterNameIndexArray.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12677
	self network kBytesReceivedPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12678
	self network kBytesReceivedPerSecondFromLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12679
	self network kBytesSentPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12680
	self network kBytesSentPerSecondFromLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12681
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12682
	self memory getCounterNameIndexArray.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12683
	self memory availableMBytes.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12684
	self memory availableKBytes.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12685
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12686
	self diskIO getCounterNameIndexArray.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12687
	self diskIO diskSpaceFreeInMegaByte.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12688
	self diskIO diskQueueLength.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12689
	self diskIO diskTransfersPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12690
	self diskIO diskTransfersPerSecondFromlast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12691
	self diskIO diskReadsPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12692
	self diskIO diskReadsPerSecondFromLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12693
	self diskIO diskWritesPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12694
	self diskIO diskWritesPerSecondFromLast.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12695
	self diskIO diskBytesPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12696
	self diskIO diskBytesPerSecondFromLast.
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12697
    "
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12698
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12699
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12700
!Win32OperatingSystem::PerformanceData class methodsFor:'initialization'!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12701
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12702
initialize
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12703
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12704
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12705
	self initialize
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12706
    "
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12707
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12708
    PerformanceText := CounterIndexTextDictionary := HelpIndexTextDictionary := nil.
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12709
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12710
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12711
!Win32OperatingSystem::PerformanceData class methodsFor:'private'!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12712
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12713
getPerformanceText
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12714
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12715
    PerformanceText isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12716
	PerformanceText := Win32OperatingSystem registryEntry key:'HKEY_PERFORMANCE_TEXT'.
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12717
    ].
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12718
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12719
    ^ PerformanceText
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12720
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12721
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12722
!Win32OperatingSystem::PerformanceData class methodsFor:'queries - memory'!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12723
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12724
getFreePageFileSizeInKB
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 12725
    |ret|
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12726
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12727
    %{
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12728
	MEMORYSTATUS mState;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12729
	GlobalMemoryStatus (&mState);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12730
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12731
	ret = __mkSmallInteger(mState.dwAvailPageFile / 1024);
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12732
    %}.
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12733
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 12734
    ^ ret
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 12735
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 12736
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12737
	self getFreePageFileSizeInKB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12738
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12739
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12740
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12741
getFreePageFileSizeInMB
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 12742
    ^ (self getFreePageFileSizeInKB / 1024) asInteger
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 12743
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 12744
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12745
	self getFreePageFileSizeInMB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12746
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12747
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12748
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12749
getFreePhysicalMemoryInKB
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 12750
    |ret|
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12751
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12752
    %{
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12753
	MEMORYSTATUS mState;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12754
	GlobalMemoryStatus (&mState);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12755
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12756
	ret = __mkSmallInteger(mState.dwAvailPhys / 1024);
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12757
    %}.
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12758
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 12759
    ^ ret
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
 12760
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
 12761
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12762
	self getFreePhysicalMemoryInKB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12763
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12764
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12765
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12766
getFreePhysicalMemoryInMB
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 12767
    ^ (self getFreePhysicalMemoryInKB / 1024) asInteger
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 12768
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 12769
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12770
	self getFreePhysicalMemoryInMB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12771
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12772
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12773
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12774
getPageFileSizeInKB
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12775
    ^ self getPageFileSizeInMB * 1024
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12776
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12777
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12778
	self getPageFileSizeInKB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12779
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12780
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12781
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12782
getPageFileSizeInMB
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 12783
    |ret|
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12784
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12785
    %{
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12786
	SYSTEM_INFO sInfo;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12787
	GetSystemInfo(&sInfo);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12788
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12789
	ret = __mkSmallInteger(sInfo.dwPageSize);
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12790
    %}.
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12791
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 12792
    ^ ret
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 12793
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 12794
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12795
	self getPageFileSizeInMB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12796
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12797
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12798
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12799
getPhysicalMemoryInKB
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 12800
    |ret|
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12801
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12802
    %{
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12803
	MEMORYSTATUS mState;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12804
	GlobalMemoryStatus (&mState);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12805
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12806
	ret = __mkSmallInteger(mState.dwTotalPhys / 1024);
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12807
    %}.
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12808
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 12809
    ^ ret
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 12810
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 12811
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12812
	self getPhysicalMemoryInKB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12813
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12814
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12815
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12816
getPhysicalMemoryInMB
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 12817
    ^ (self getPhysicalMemoryInKB / 1024) asInteger
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 12818
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 12819
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12820
	self getPhysicalMemoryInMB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12821
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12822
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12823
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12824
getUsedMemoryInPercentage
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 12825
    |ret|
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12826
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12827
    %{
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12828
	MEMORYSTATUS mState;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12829
	GlobalMemoryStatus (&mState);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12830
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12831
	ret = __mkSmallInteger(mState.dwMemoryLoad);
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12832
    %}.
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12833
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 12834
    ^ ret
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 12835
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 12836
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12837
	self getUsedMemoryInPercentage
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12838
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12839
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12840
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12841
getVirtualMemoryInKB
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 12842
    |ret|
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12843
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12844
    %{
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12845
	MEMORYSTATUS mState;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12846
	GlobalMemoryStatus (&mState);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12847
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12848
	ret = __mkSmallInteger(mState.dwTotalVirtual / 1024);
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12849
    %}.
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12850
10771
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 12851
    ^ ret
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 12852
f336281a488e *** empty log message ***
sr
parents: 10758
diff changeset
 12853
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12854
	self getVirtualMemoryInKB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12855
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12856
!
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12857
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12858
getVirtualMemoryInMB
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 12859
    ^ (self getVirtualMemoryInKB / 1024) asInteger
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 12860
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 12861
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 12862
	self getVirtualMemoryInMB
10718
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12863
    "
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12864
! !
1c90fa042d79 *** empty log message ***
sr
parents: 10712
diff changeset
 12865
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12866
!Win32OperatingSystem::PerformanceData methodsFor:'accessing'!
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12867
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12868
objectArray
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12869
    ^ objectArray
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12870
!
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12871
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12872
perfFreq
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12873
    ^ perfFreq
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12874
!
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12875
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12876
perfTime
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12877
    ^ perfTime
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12878
!
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12879
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12880
perfTime100nSec
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12881
    ^ perfTime100nSec
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12882
! !
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12883
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12884
!Win32OperatingSystem::PerformanceData methodsFor:'setup'!
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12885
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12886
fromRawBytes:st_data
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 12887
    |
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 12888
    getNameBlock getCounterValueBlock
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12889
    st_perfTime st_perfFreq st_perfTime100nSec
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12890
    st_objectArray st_counterArray st_instanceArray
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12891
    st_perObject st_perCounter st_perInstance
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12892
    |
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12893
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12894
%{
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12895
    //declarate counters
10741
68517f1a68a7 *** empty log message ***
sr
parents: 10735
diff changeset
 12896
    int objectIterator, counterIterator, instanceIterator, numObjectTypes;
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12897
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12898
    //declarate pointers
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12899
    PERF_DATA_BLOCK *perfData;
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12900
    PERF_OBJECT_TYPE *perfObjectPtr;
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12901
    PERF_COUNTER_DEFINITION *perfCounterPtr;
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12902
    PERF_INSTANCE_DEFINITION *perfInstancePtr;
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12903
    PERF_COUNTER_BLOCK *perfCounterBlockPtr;
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12904
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12905
    #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
 12906
    #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
 12907
    #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
 12908
#ifdef PERF_COUNTER_PRECISION
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12909
    #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
 12910
#else
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 12911
    #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
 12912
#endif
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12913
    #define PERF_TEXTTYPE_MASK    (PERF_TEXT_UNICODE|PERF_TEXT_ASCII)
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12914
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12915
    if (!__isByteArray(st_data)) RETURN (nil);
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12916
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12917
    //setup start pointer
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12918
    perfData = (PERF_DATA_BLOCK *)(__ByteArrayInstPtr(st_data)->ba_element);
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12919
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12920
    //get header data
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12921
    st_perfTime = __MKINT64(&(perfData->PerfTime));
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12922
    st_perfFreq = __MKINT64(&(perfData->PerfFreq));
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12923
    st_perfTime100nSec = __MKINT64(&(perfData->PerfTime100nSec));
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12924
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12925
    //setup object array and initialize its pointer
10741
68517f1a68a7 *** empty log message ***
sr
parents: 10735
diff changeset
 12926
    numObjectTypes = perfData->NumObjectTypes;
68517f1a68a7 *** empty log message ***
sr
parents: 10735
diff changeset
 12927
    st_objectArray = __ARRAY_NEW_INT(numObjectTypes);
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 12928
    perfObjectPtr = (PERF_OBJECT_TYPE *)((char *)perfData + perfData->HeaderLength);
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12929
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 12930
    //iterate all following objetcs
10741
68517f1a68a7 *** empty log message ***
sr
parents: 10735
diff changeset
 12931
    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
 12932
	//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
 12933
	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
 12934
	__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
 12935
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 12936
	//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
 12937
	__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
 12938
	__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
 12939
	__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
 12940
	__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
 12941
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 12942
	//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
 12943
	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
 12944
	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
 12945
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 12946
	//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
 12947
	__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
 12948
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 12949
	//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
 12950
	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
 12951
	    //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
 12952
	    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
 12953
	    __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
 12954
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 12955
	    //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
 12956
	    __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
 12957
	    __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
 12958
	    __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
 12959
	    __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
 12960
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 12961
	    //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
 12962
	    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
 12963
		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
 12964
		    __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
 12965
		    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 12966
		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
 12967
		    __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
 12968
		    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 12969
		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
 12970
		    __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
 12971
		    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 12972
		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
 12973
		    __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
 12974
		    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 12975
	    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 12976
	    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
 12977
		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
 12978
		    __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
 12979
		    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
 12980
			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
 12981
			    __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
 12982
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 12983
			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
 12984
			    __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
 12985
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 12986
			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
 12987
			    __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
 12988
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 12989
		    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 12990
		    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 12991
		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
 12992
		    __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
 12993
		    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
 12994
			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
 12995
			    __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
 12996
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 12997
			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
 12998
			    __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
 12999
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13000
			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
 13001
			    __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
 13002
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13003
			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
 13004
			    __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
 13005
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13006
			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
 13007
			    __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
 13008
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13009
			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
 13010
			    __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
 13011
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13012
			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
 13013
			    __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
 13014
			    break;
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 13015
#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
 13016
			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
 13017
			    __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
 13018
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13019
#endif
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13020
		    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13021
		    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13022
		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
 13023
		    __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
 13024
		    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
 13025
			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
 13026
			    __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
 13027
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13028
			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
 13029
			    __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
 13030
			    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13031
		    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13032
		    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13033
		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
 13034
		    __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
 13035
		    break;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13036
	    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13037
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13038
	    //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
 13039
	    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
 13040
	}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13041
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13042
	//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
 13043
	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
 13044
	    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
 13045
	    __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
 13046
	} else {
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13047
	    //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
 13048
	    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
 13049
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13050
	    //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
 13051
	    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
 13052
	    __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
 13053
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13054
	    //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
 13055
	    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
 13056
		//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
 13057
		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
 13058
		__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
 13059
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13060
		//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
 13061
		__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
 13062
		__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
 13063
		__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
 13064
		__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
 13065
		__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
 13066
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13067
		//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
 13068
		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
 13069
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13070
		//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
 13071
		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
 13072
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13073
		//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
 13074
		__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
 13075
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13076
		//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
 13077
		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
 13078
	    }
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13079
	}
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13080
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13081
	//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
 13082
	perfObjectPtr = (PERF_OBJECT_TYPE *)((char *)perfObjectPtr + perfObjectPtr->TotalByteLength);
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 13083
    }
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13084
%}.
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13085
    objectArray := st_objectArray.
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13086
    perfTime := st_perfTime.
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13087
    perfFreq := st_perfFreq.
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13088
    perfTime100nSec := st_perfTime100nSec.
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13089
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13090
    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
 13091
	self class counterIndexTextDictionary at:i ifAbsent:['<<no name>>'].
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13092
    ].
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13093
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13094
    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
 13095
	|offset counterValue|
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13096
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13097
	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
 13098
	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
 13099
	    counterValue := nil.
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13100
	] ifFalse:[
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13101
	    (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
 13102
		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
 13103
	    ] ifFalse:[
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13104
		(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
 13105
		    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
 13106
		] ifFalse:[
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13107
		    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
 13108
		].
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13109
	    ].
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13110
	].
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13111
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13112
	counterValue
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13113
    ].
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13114
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13115
    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
 13116
	"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
 13117
	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
 13118
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13119
	"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
 13120
	(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
 13121
	    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
 13122
	    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
 13123
	].
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13124
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13125
	(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
 13126
	    |rawData|
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13127
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13128
	    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
 13129
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13130
	    (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
 13131
		(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
 13132
	    ].
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13133
	] ifFalse:[
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13134
	    (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
 13135
		|rawData|
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13136
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13137
		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
 13138
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13139
		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
 13140
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13141
		(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
 13142
		    (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
 13143
		].
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13144
	    ].
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 13145
	].
10683
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13146
    ].
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13147
faf98e9aa682 *** empty log message ***
sr
parents: 10682
diff changeset
 13148
    ^ self
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13149
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13150
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13151
!Win32OperatingSystem::PerformanceData::Abstract methodsFor:'accessing'!
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13152
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13153
cachedResults
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13154
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13155
    cachedResults isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13156
	cachedResults := IdentityDictionary new.
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13157
    ].
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13158
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13159
    ^ cachedResults
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13160
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13161
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13162
lastData
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13163
    ^ lastData
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13164
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13165
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13166
lastData:something
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13167
    lastData := something.
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13168
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13169
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13170
lastTimestamp
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13171
    ^ lastTimestamp
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13172
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13173
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13174
lastTimestamp:something
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13175
    lastTimestamp := something.
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13176
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13177
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13178
!Win32OperatingSystem::PerformanceData::Abstract methodsFor:'definitions'!
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13179
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13180
aliveTime
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13181
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13182
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13183
	returns the time a data stays alive, in milliseconds
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13184
	before we push a new call and overwrite the data
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13185
    "
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13186
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13187
    ^ self subclassResponsibility
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13188
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13189
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13190
indexedName
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13191
    ^ self subclassResponsibility
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13192
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13193
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13194
indexedNameNumbered
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13195
    ^ self indexedName asInteger
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13196
!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13197
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13198
timedQueryMilliseconds
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13199
    ^ 100
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13200
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13201
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13202
!Win32OperatingSystem::PerformanceData::Abstract methodsFor:'private'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13203
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13204
data
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13205
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13206
    self synchronized:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13207
	|lastTS|
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
	lastTS := self lastTimestamp.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13210
	lastTS isNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13211
	    ^ self dataBasic
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13212
	] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13213
	    Timestamp now asMilliseconds - lastTS >= self aliveTime ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13214
		^ self dataBasic
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13215
	    ] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13216
		^ self lastData
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13217
	    ].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13218
	].
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13219
    ].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13220
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13221
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13222
dataBasic
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13223
    |regEntry|
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13224
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13225
    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
 13226
    self assert:(regEntry notNil).
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13227
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13228
    self lastTimestamp:Timestamp now asMilliseconds.
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13229
    self lastData:(Win32OperatingSystem::PerformanceData new fromRawBytes:regEntry).
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13230
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13231
    ^ self lastData
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13232
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13233
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13234
!Win32OperatingSystem::PerformanceData::Abstract methodsFor:'queries'!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13235
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13236
getCounterNameIndexArray
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13237
    |data object debugBlock|
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13238
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13239
    data := self data.
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13240
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13241
    self indexedNameNumbered == 0 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13242
	object := data objectArray at:1 ifAbsent:[debugBlock value:(object at:#ObjectNameTitle)].
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13243
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13244
	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
 13245
    ].
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13246
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13247
    ^ (object at:#Counters) collect:[:el|Array with:(el at:#CounterNameTitle) with:(el at:#CounterNameTitleIndex)].
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13248
! !
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13249
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13250
!Win32OperatingSystem::PerformanceData::Abstract methodsFor:'queries - timed'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13251
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13252
getPerSecondFromLast:aSelector
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13253
    |cachedResult return|
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13254
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13255
    cachedResult := self cachedResults at:aSelector ifAbsent:nil.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13256
    cachedResult notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13257
	|currentResult|
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
	currentResult := self perform:aSelector.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13260
	return := self getPerSecondViaResult1:cachedResult result2:currentResult.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13261
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13262
	self cachedResults at:aSelector put:currentResult.
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13263
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13264
	self cachedResults at:aSelector put:(self perform:aSelector).
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13265
    ].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13266
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13267
    ^ return
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13268
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13269
10701
b8c876510d1d *** empty log message ***
sr
parents: 10699
diff changeset
 13270
getPerSecondViaPerformBlock:performBlock
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13271
    |result1 result2 runTimeInNS runTimeInS values1 values2 globalResult|
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13272
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13273
    self assert:(self aliveTime < self timedQueryMilliseconds).
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13274
10701
b8c876510d1d *** empty log message ***
sr
parents: 10699
diff changeset
 13275
    result1 := performBlock value.
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13276
    Delay waitForMilliseconds:self timedQueryMilliseconds.
10701
b8c876510d1d *** empty log message ***
sr
parents: 10699
diff changeset
 13277
    result2 := performBlock value.
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13278
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13279
    runTimeInNS := ((result2 at:#time100nSec) - (result1 at:#time100nSec)) * 100.
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13280
    runTimeInS := runTimeInNS / 1000 / 1000 / 1000.
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13281
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13282
    values1 := result1 at:#values.
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13283
    values2 := result2 at:#values.
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13284
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13285
    globalResult := Dictionary new.
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13286
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13287
    values2 keysDo:[:key|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13288
	|difference|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13289
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13290
	difference := (values2 at:key) - (values1 at:key).
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
	runTimeInS = 0 ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13293
	    globalResult at:key put:0.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13294
	] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13295
	    globalResult at:key put:(difference / runTimeInS) asFloat.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13296
	].
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13297
    ].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13298
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13299
    ^ globalResult
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13300
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13301
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13302
getPerSecondViaResult1:result1 result2:result2
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13303
    |runTimeInNS runTimeInS values1 values2 globalResult|
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13304
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13305
    runTimeInNS := ((result2 at:#time100nSec) - (result1 at:#time100nSec)) * 100.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13306
    runTimeInS := runTimeInNS / 1000 / 1000 / 1000.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13307
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13308
    values1 := result1 at:#values.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13309
    values2 := result2 at:#values.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13310
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13311
    globalResult := Dictionary new.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13312
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13313
    values2 keysDo:[:key|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13314
	|difference|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13315
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13316
	difference := (values2 at:key) - (values1 at:key).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13317
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13318
	runTimeInS = 0 ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13319
	    globalResult at:key put:0.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13320
	] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13321
	    globalResult at:key put:(difference / runTimeInS) asFloat.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13322
	].
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13323
    ].
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13324
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13325
    ^ globalResult
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13326
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13327
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13328
getUsageFromLast:aSelector
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13329
    |cachedResult return|
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13330
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13331
    cachedResult := self cachedResults at:aSelector ifAbsent:nil.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13332
    cachedResult notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13333
	|currentResult|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13334
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13335
	currentResult := self perform:aSelector.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13336
	return := self getUsageViaResult1:cachedResult result2:currentResult.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13337
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13338
	self cachedResults at:aSelector put:currentResult.
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13339
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13340
	self cachedResults at:aSelector put:(self perform:aSelector).
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13341
    ].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13342
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13343
    ^ return
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13344
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13345
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13346
getUsageViaPerformBlock:performBlock
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13347
    |result1 result2 deltaTIn100Ns value1 value2 globalResult|
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13348
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13349
    self assert:(self aliveTime < self timedQueryMilliseconds).
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13350
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13351
    result1 := performBlock value.
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13352
    Delay waitForMilliseconds:self timedQueryMilliseconds.
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13353
    result2 := performBlock value.
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13354
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13355
    globalResult := Dictionary new.
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13356
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13357
    deltaTIn100Ns := (result2 at:#time100nSec) - (result1 at:#time100nSec).
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13358
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13359
    value1 := result1 at:#values.
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13360
    value2 := result2 at:#values.
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13361
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13362
    value1 keysDo:[:key|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13363
	|diff dPerSecond load1024 res|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13364
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13365
	diff := (value2 at:key) - (value1 at:key).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13366
	diff := diff bitShift:10.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13367
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13368
	deltaTIn100Ns = 0 ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13369
	    dPerSecond := 0.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13370
	] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13371
	    dPerSecond := (diff / deltaTIn100Ns) asFloat.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13372
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13373
	load1024 := 1024 - dPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13374
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13375
	res := (load1024 / 1024 * 100) asFloat.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13376
	res < 0 ifTrue:[res := 0].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13377
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13378
	globalResult at:key put:res.
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13379
    ].
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13380
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13381
    ^ globalResult
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13382
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13383
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13384
getUsageViaResult1:result1 result2:result2
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13385
    |deltaTIn100Ns value1 value2 globalResult|
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13386
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13387
    globalResult := Dictionary new.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13388
    deltaTIn100Ns := (result2 at:#time100nSec) - (result1 at:#time100nSec).
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13389
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13390
    value1 := result1 at:#values.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13391
    value2 := result2 at:#values.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13392
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13393
    value1 keysDo:[:key|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13394
	|diff dPerSecond load1024 res|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13395
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13396
	diff := (value2 at:key) - (value1 at:key).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13397
	diff := diff bitShift:10.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13398
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13399
	deltaTIn100Ns = 0 ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13400
	    dPerSecond := 0.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13401
	] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13402
	    dPerSecond := (diff / deltaTIn100Ns) asFloat.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13403
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13404
	load1024 := 1024 - dPerSecond.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13405
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13406
	res := (load1024 / 1024 * 100) asFloat.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13407
	res < 0 ifTrue:[res := 0].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13408
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13409
	globalResult at:key put:res.
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13410
    ].
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13411
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13412
    ^ globalResult
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13413
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13414
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13415
!Win32OperatingSystem::PerformanceData::Abstract methodsFor:'queries - values'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13416
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13417
getBasicValuesByCounter:counterIndex
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13418
    ^ self getBasicValuesByObject:0 counter:counterIndex timed:false
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13419
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13420
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 13421
getBasicValuesByCounter:counterIndex timed:aBoolean
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 13422
    ^ self getBasicValuesByObject:0 counter:counterIndex timed:aBoolean
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13423
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13424
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13425
getBasicValuesByObject:objectIndex counter:counterIndex
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13426
    ^ self getBasicValuesByObject:0 counter:counterIndex timed:false
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13427
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13428
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 13429
getBasicValuesByObject:objectIndex counter:counterIndex timed:aBoolean
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13430
    |data object counter values debugBlock numInstances|
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13431
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13432
    debugBlock := [:obj|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13433
	^ 'obj:', obj , ' this:', self printString , ' idx:', self indexedName
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13434
    ].
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13435
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13436
    data := self dataBasic.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13437
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13438
    objectIndex == 0 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13439
	object := data objectArray at:1 ifAbsent:[debugBlock value:(object at:#ObjectNameTitle)].
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13440
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13441
	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
 13442
    ].
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13443
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13444
    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
 13445
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13446
    values := Dictionary new.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13447
    numInstances := object at:#NumInstances.
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13448
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13449
    numInstances > 0 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13450
	1 to:numInstances do:[:idx|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13451
	    |value instanceName|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13452
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13453
	    value := (counter at:#CounterValueArray) at:idx.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13454
	    instanceName := ((object at:#Instances) at:idx) at:#Name.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13455
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13456
	    values at:instanceName put:value.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13457
	].
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13458
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13459
	values at:'<<singleton>>' put:(counter at:#CounterValueArray) first.
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13460
    ].
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13461
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 13462
    aBoolean ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13463
	|return|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13464
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13465
	return := IdentityDictionary new.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13466
	return at:#time put:data perfTime.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13467
	return at:#frequence put:data perfFreq.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13468
	return at:#time100nSec put:data perfTime100nSec.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13469
	return at:#values put:values.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13470
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13471
	^ return
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13472
    ].
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13473
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13474
    ^ values
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13475
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 13476
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13477
getValuesByCounter:counterIndex
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13478
    ^ self getValuesByObject:0 counter:counterIndex timed:false
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13479
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13480
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 13481
getValuesByCounter:counterIndex timed:aBoolean
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 13482
    ^ self getValuesByObject:0 counter:counterIndex timed:aBoolean
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13483
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13484
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13485
getValuesByObject:objectIndex counter:counterIndex
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13486
    ^ self getValuesByObject:0 counter:counterIndex timed:false
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13487
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13488
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 13489
getValuesByObject:objectIndex counter:counterIndex timed:aBoolean
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13490
    |data object counter values debugBlock numInstances|
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13491
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13492
    debugBlock := [:obj|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13493
	^ 'obj:', obj , ' this:', self printString , ' idx:', self indexedName
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13494
    ].
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
    data := self data.
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13497
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13498
    objectIndex == 0 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13499
	object := data objectArray at:1 ifAbsent:[debugBlock value:(object at:#ObjectNameTitle)].
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13500
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13501
	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
 13502
    ].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13503
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13504
    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
 13505
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13506
    values := Dictionary new.
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13507
    numInstances := object at:#NumInstances.
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13508
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13509
    numInstances > 0 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13510
	1 to:numInstances do:[:idx|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13511
	    |value instanceName|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13512
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13513
	    value := (counter at:#CounterValueArray) at:idx.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13514
	    instanceName := ((object at:#Instances) at:idx) at:#Name.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13515
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13516
	    values at:instanceName put:value.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13517
	].
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13518
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13519
	values at:'<<singleton>>' put:(counter at:#CounterValueArray) first.
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13520
    ].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13521
14756
d81b09ba6b83 compilability
Claus Gittinger <cg@exept.de>
parents: 14746
diff changeset
 13522
    aBoolean ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13523
	|return|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13524
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13525
	return := IdentityDictionary new.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13526
	return at:#time put:data perfTime.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13527
	return at:#frequence put:data perfFreq.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13528
	return at:#time100nSec put:data perfTime100nSec.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13529
	return at:#values put:values.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13530
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13531
	^ return
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13532
    ].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13533
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13534
    ^ values
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13535
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13536
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13537
!Win32OperatingSystem::PerformanceData::DiskIO class methodsFor:'accessing'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13538
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13539
current
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13540
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13541
    TheOneAndOnlyInstance isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13542
	TheOneAndOnlyInstance := self new.
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13543
    ].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13544
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13545
    ^ TheOneAndOnlyInstance
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13546
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13547
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13548
!Win32OperatingSystem::PerformanceData::DiskIO methodsFor:'definition'!
10688
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
 13549
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
 13550
aliveTime
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13551
    ^ 80
10688
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
 13552
!
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
 13553
1e8dc6018c76 *** empty log message ***
sr
parents: 10687
diff changeset
 13554
indexedName
10704
5063fe06352c *** empty log message ***
sr
parents: 10702
diff changeset
 13555
    ^ '236'
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13556
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13557
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13558
!Win32OperatingSystem::PerformanceData::DiskIO methodsFor:'queries'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13559
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13560
diskBytes
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13561
    ^ self getValuesByCounter:218 timed:true
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13562
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13563
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13564
	self current diskBytes
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13565
    "
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13566
!
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13567
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13568
diskBytesBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13569
    ^ self getBasicValuesByCounter:218 timed:true
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13570
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13571
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13572
	self current diskBytesBasic
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13573
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13574
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13575
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13576
diskBytesPerSecond
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13577
    ^ self getPerSecondViaPerformBlock:[self diskBytes]
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13578
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13579
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13580
	self current diskBytesPerSecond
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13581
    "
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13582
!
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13583
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13584
diskBytesPerSecondFromLast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13585
    ^ self getPerSecondFromLast:#diskBytesBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13586
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13587
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13588
	self current diskBytesPerSecondFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13589
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13590
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13591
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13592
diskQueueLength
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13593
    ^ self getValuesByCounter:198
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13594
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13595
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13596
	self current diskQueueLength
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13597
    "
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13598
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13599
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13600
diskRead
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13601
    ^ self getValuesByCounter:214 timed:true
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13602
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13603
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13604
	self current diskRead
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13605
    "
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13606
!
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13607
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13608
diskReadBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13609
    ^ self getBasicValuesByCounter:214 timed:true
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13610
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13611
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13612
	self current diskReadBasic
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13613
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13614
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13615
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13616
diskReadsPerSecond
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13617
    ^ self getPerSecondViaPerformBlock:[self diskRead]
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13618
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13619
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13620
	self current diskReadsPerSecond
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13621
    "
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13622
!
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13623
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13624
diskReadsPerSecondFromLast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13625
    ^ self getPerSecondFromLast:#diskReadBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13626
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13627
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13628
	self current diskReadsPerSecondFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13629
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13630
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13631
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13632
diskSpaceFreeInMegaByte
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13633
    ^ self getValuesByCounter:408
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13634
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13635
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13636
	self current diskSpaceFreeInMegaByte
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13637
    "
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13638
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13639
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13640
diskTransfers
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13641
    ^ self getValuesByCounter:212 timed:true
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13642
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13643
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13644
	self current diskTransfers
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13645
    "
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13646
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13647
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13648
diskTransfersBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13649
    ^ self getBasicValuesByCounter:212 timed:true
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13650
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13651
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13652
	self current diskTransfersBasic
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13653
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13654
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13655
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13656
diskTransfersPerSecond
10701
b8c876510d1d *** empty log message ***
sr
parents: 10699
diff changeset
 13657
    ^ self getPerSecondViaPerformBlock:[self diskTransfers]
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13658
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13659
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13660
	self current diskTransfersPerSecond
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13661
    "
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13662
!
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13663
10757
a5e2e0f500df *** empty log message ***
sr
parents: 10756
diff changeset
 13664
diskTransfersPerSecondFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13665
    ^ self getPerSecondFromLast:#diskTransfersBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13666
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13667
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13668
	self current diskTransfersPerSecondFromlast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13669
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13670
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13671
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13672
diskWrite
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13673
    ^ self getValuesByCounter:216 timed:true
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13674
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13675
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13676
	self current diskWrite
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13677
    "
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13678
!
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13679
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13680
diskWriteBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13681
    ^ self getBasicValuesByCounter:216 timed:true
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13682
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13683
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13684
	self current diskWriteBasic
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13685
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13686
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13687
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13688
diskWritesPerSecond
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13689
    ^ self getPerSecondViaPerformBlock:[self diskWrite]
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13690
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13691
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13692
	self current diskWritesPerSecond
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13693
    "
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13694
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13695
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13696
diskWritesPerSecondFromLast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13697
    ^ self getPerSecondFromLast:#diskWriteBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13698
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13699
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13700
	self current diskWritesPerSecondFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13701
    "
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13702
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13703
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13704
!Win32OperatingSystem::PerformanceData::Global class methodsFor:'accessing'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13705
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13706
current
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13707
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13708
    TheOneAndOnlyInstance isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13709
	TheOneAndOnlyInstance := self new.
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13710
    ].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13711
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13712
    ^ TheOneAndOnlyInstance
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13713
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13714
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 13715
!Win32OperatingSystem::PerformanceData::Global methodsFor:'definitions'!
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13716
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13717
aliveTime
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13718
    ^ 200
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13719
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13720
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13721
indexedName
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13722
    ^ 'Global'
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13723
! !
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 13724
10706
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 13725
!Win32OperatingSystem::PerformanceData::Global methodsFor:'queries'!
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 13726
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 13727
getCounterNameIndexArray
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 13728
    self error:'Global implements objects only'.
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 13729
!
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 13730
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 13731
getObjectNameIndexArray
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 13732
    |data indexNameArray|
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 13733
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 13734
    data := self data.
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 13735
    indexNameArray := OrderedCollection new.
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 13736
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 13737
    data objectArray do:[:anObject|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13738
	|index name|
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13739
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13740
	index := anObject at:#ObjectNameTitleIndex.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13741
	name := Win32OperatingSystem::PerformanceData counterIndexTextDictionary at:index.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13743
	indexNameArray add:(Array with:name with:index).
10706
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 13744
    ].
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 13745
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 13746
    ^ indexNameArray
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 13747
! !
8fb6824a5c70 *** empty log message ***
sr
parents: 10705
diff changeset
 13748
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13749
!Win32OperatingSystem::PerformanceData::Memory class methodsFor:'accessing'!
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13750
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13751
current
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13752
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13753
    TheOneAndOnlyInstance isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13754
	TheOneAndOnlyInstance := self new.
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13755
    ].
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13756
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13757
    ^ TheOneAndOnlyInstance
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13758
! !
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13759
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13760
!Win32OperatingSystem::PerformanceData::Memory methodsFor:'definitions'!
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13761
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13762
aliveTime
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13763
    ^ 80
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13764
!
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13765
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13766
indexedName
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13767
    ^ '4'
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13768
! !
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13769
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13770
!Win32OperatingSystem::PerformanceData::Memory methodsFor:'queries'!
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13771
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13772
availableKBytes
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13773
    ^ self getValuesByCounter:1380
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13774
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13775
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13776
	self current availableKBytes
10709
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13777
    "
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13778
!
4fcacc463bcf *** empty log message ***
sr
parents: 10707
diff changeset
 13779
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13780
availableMBytes
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13781
    ^ self getValuesByCounter:1382
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13782
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13783
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13784
	self current availableMBytes
10707
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13785
    "
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13786
! !
3b21d7c079fd *** empty log message ***
sr
parents: 10706
diff changeset
 13787
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13788
!Win32OperatingSystem::PerformanceData::Network class methodsFor:'accessing'!
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13789
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13790
current
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13791
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13792
    TheOneAndOnlyInstance isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13793
	TheOneAndOnlyInstance := self new.
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13794
    ].
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13795
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13796
    ^ TheOneAndOnlyInstance
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13797
! !
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13798
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13799
!Win32OperatingSystem::PerformanceData::Network methodsFor:'definition'!
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13800
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13801
aliveTime
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13802
    ^ 80
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13803
!
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13804
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13805
indexedName
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13806
    ^ '510'
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13807
!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13808
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13809
timedQueryMilliseconds
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13810
    ^ 200
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13811
! !
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13812
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13813
!Win32OperatingSystem::PerformanceData::Network methodsFor:'queries'!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13814
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13815
bytesReceived
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13816
    ^ self getValuesByCounter:264 timed:true
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13817
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13818
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13819
	self current bytesReceived
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13820
    "
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13821
!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13822
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13823
bytesReceivedBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13824
    ^ self getBasicValuesByCounter:264 timed:true
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13825
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13826
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13827
	self current bytesReceivedBasic
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13828
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13829
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13830
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13831
bytesReceivedPerSecond
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13832
    ^ self getPerSecondViaPerformBlock:[self bytesReceived]
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13833
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13834
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13835
	self current bytesReceivedPerSecond
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13836
    "
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13837
!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13838
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13839
bytesReceivedPerSecondFromlast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13840
    ^ self getPerSecondFromLast:#bytesReceivedBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13841
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13842
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13843
	self current bytesReceivedPerSecondFromlast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13844
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13845
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13846
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13847
bytesSent
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13848
    ^ self getValuesByCounter:506 timed:true
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13849
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13850
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13851
	self current bytesSent
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13852
    "
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13853
!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13854
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13855
bytesSentBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13856
    ^ self getBasicValuesByCounter:506 timed:true
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13857
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13858
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13859
	self current bytesSentBasic
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13860
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13861
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13862
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13863
bytesSentPerSecond
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13864
    ^ self getPerSecondViaPerformBlock:[self bytesSent]
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13865
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13866
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13867
	self current bytesSentPerSecond
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13868
    "
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13869
!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13870
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13871
bytesSentPerSecondFromlast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13872
    ^ self getPerSecondFromLast:#bytesSentBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13873
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13874
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13875
	self current bytesSentPerSecondFromlast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13876
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13877
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13878
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13879
kBytesReceivedPerSecond
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13880
    |modifiedDictionary|
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13881
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13882
    modifiedDictionary := Dictionary new.
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13883
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13884
    (self getPerSecondViaPerformBlock:[self bytesReceived]) keysAndValuesDo:[:key :value|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13885
	modifiedDictionary at:key put:(value / 1024).
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13886
    ].
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13887
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13888
    ^ modifiedDictionary
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13889
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13890
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13891
	self current kBytesReceivedPerSecond
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13892
    "
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13893
!
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13894
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13895
kBytesReceivedPerSecondFromLast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13896
    |return modifiedDictionary|
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13897
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13898
    return := self bytesReceivedPerSecondFromlast.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13899
    return isNil ifTrue:[^ nil].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13900
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13901
    modifiedDictionary := Dictionary new.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13902
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13903
    return keysAndValuesDo:[:key :value|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13904
	modifiedDictionary at:key put:(value / 1024).
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13905
    ].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13906
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13907
    ^ modifiedDictionary
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13908
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13909
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13910
	self current kBytesReceivedPerSecondFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13911
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13912
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13913
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13914
kBytesSentPerSecond
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13915
    |modifiedDictionary|
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13916
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13917
    modifiedDictionary := Dictionary new.
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13918
10711
a1682cfba987 *** empty log message ***
sr
parents: 10710
diff changeset
 13919
    (self getPerSecondViaPerformBlock:[self bytesSent]) keysAndValuesDo:[:key :value|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13920
	modifiedDictionary at:key put:(value / 1024).
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13921
    ].
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13922
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13923
    ^ modifiedDictionary
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13924
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13925
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13926
	self current kBytesSentPerSecond
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13927
    "
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13928
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13929
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13930
kBytesSentPerSecondFromLast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13931
    |return modifiedDictionary|
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13932
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13933
    return := self bytesSentPerSecondFromlast.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13934
    return isNil ifTrue:[^ nil].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13935
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13936
    modifiedDictionary := Dictionary new.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13937
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13938
    return keysAndValuesDo:[:key :value|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13939
	modifiedDictionary at:key put:(value / 1024).
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13940
    ].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13941
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13942
    ^ modifiedDictionary
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13943
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13944
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13945
	self current kBytesSentPerSecondFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13946
    "
10710
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13947
! !
1055a716e253 *** empty log message ***
sr
parents: 10709
diff changeset
 13948
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13949
!Win32OperatingSystem::PerformanceData::Process class methodsFor:'accessing'!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13950
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13951
current
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13952
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13953
    TheOneAndOnlyInstance isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13954
	TheOneAndOnlyInstance := self new.
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13955
    ].
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13956
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13957
    ^ TheOneAndOnlyInstance
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13958
! !
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13959
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13960
!Win32OperatingSystem::PerformanceData::Process methodsFor:'definition'!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13961
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13962
aliveTime
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13963
    ^ 80
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13964
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13965
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13966
indexedName
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13967
    ^ '230'
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13968
! !
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13969
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13970
!Win32OperatingSystem::PerformanceData::Process methodsFor:'queries'!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13971
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13972
processTime
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13973
    ^ self getValuesByCounter:6 timed:true
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13974
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 13975
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13976
	self current processTime
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13977
    "
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13978
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13979
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13980
processTimeBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13981
    ^ self getBasicValuesByCounter:6 timed:true
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13982
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13983
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13984
	self current processTimeBasic
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13985
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13986
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 13987
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13988
processUsage
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13989
    |modifiedDictionary|
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13990
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13991
    modifiedDictionary := Dictionary new.
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13992
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13993
    (self getUsageViaPerformBlock:[self processTime]) keysAndValuesDo:[:key :value|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 13994
	modifiedDictionary at:key put:(100 - value).
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13995
    ].
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13996
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13997
    ^ modifiedDictionary
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13998
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 13999
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14000
	self current processUsage
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14001
    "
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14002
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14003
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14004
processUsageFromLast
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14005
    |return modifiedDictionary|
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14006
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14007
    return := self getUsageFromLast:#processTimeBasic.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14008
    return isNil ifTrue:[^ nil].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14009
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14010
    modifiedDictionary := Dictionary new.
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14011
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14012
    return keysAndValuesDo:[:key :value|
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14013
	modifiedDictionary at:key put:(100 - value).
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14014
    ].
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14015
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14016
    ^ modifiedDictionary
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14017
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14018
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14019
	self current processUsageFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14020
    "
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14021
!
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14022
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14023
runningProcessNameList
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14024
    "_Total ~ pseudo process; Idle ~ pseudo process represents the free resources"
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14025
    ^ (self data objectArray first at:#Instances) collect:[:el|el at:#Name]
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14026
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14027
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14028
	self current runningProcessNameList
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14029
    "
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14030
!
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14031
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14032
runningProcesses
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14033
    "_Total ~ pseudo process; Idle ~ pseudo process represents the free resources"
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14034
    ^ (self data objectArray first at:#NumInstances)
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14035
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14036
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14037
	self current runningProcesses
10705
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14038
    "
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14039
! !
9110d864362d *** empty log message ***
sr
parents: 10704
diff changeset
 14040
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14041
!Win32OperatingSystem::PerformanceData::Processor class methodsFor:'accessing'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14042
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14043
current
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14044
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14045
    TheOneAndOnlyInstance isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14046
	TheOneAndOnlyInstance := self new.
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14047
    ].
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14048
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14049
    ^ TheOneAndOnlyInstance
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14050
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14051
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14052
!Win32OperatingSystem::PerformanceData::Processor methodsFor:'definitions'!
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14053
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14054
aliveTime
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14055
    ^ 80
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14056
!
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14057
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14058
indexedName
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 14059
    ^ '238'
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14060
! !
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14061
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14062
!Win32OperatingSystem::PerformanceData::Processor methodsFor:'queries'!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14063
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14064
interrupts
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14065
    ^ self getValuesByCounter:148 timed:true
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14066
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14067
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14068
	self current interrupts
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14069
    "
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14070
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14071
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14072
interruptsBasic
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14073
    ^ self getBasicValuesByCounter:148 timed:true
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14074
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14075
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14076
	self current interruptsBasic
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
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14080
interruptsPerSecond
10701
b8c876510d1d *** empty log message ***
sr
parents: 10699
diff changeset
 14081
    ^ self getPerSecondViaPerformBlock:[self interrupts]
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14082
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14083
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14084
	self current interruptsPerSecond
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14085
    "
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14086
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14087
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14088
interruptsPerSecondFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14089
    ^ self getPerSecondFromLast:#interruptsBasic
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14090
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14091
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14092
	self current interruptsPerSecondFromLast
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14093
    "
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14094
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14095
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14096
processorTime
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14097
    ^ self getValuesByCounter:6 timed:true
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14098
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 14099
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14100
	self current processorTime
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14101
    "
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14102
!
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14103
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14104
processorTimeBasic
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14105
    ^ self getBasicValuesByCounter:6 timed:true
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14106
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14107
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14108
	self current processorTimeBasic
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14109
    "
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14110
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14111
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14112
processorUsage
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
 14113
    ^ self getUsageViaPerformBlock:[self processorTime]
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
 14114
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
 14115
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14116
	self current processorUsage
10755
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14117
    "
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14118
!
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14119
c003686c37e1 *** empty log message ***
sr
parents: 10754
diff changeset
 14120
processorUsageFromLast
10756
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14121
    ^ self getUsageFromLast:#processorTimeBasic
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14122
d694d3872402 *** empty log message ***
sr
parents: 10755
diff changeset
 14123
    "
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14124
	self current processorUsageFromLast
10699
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14125
    "
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14126
! !
8fd653b16649 *** empty log message ***
sr
parents: 10696
diff changeset
 14127
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14128
!Win32OperatingSystem::PrinterInfo2Structure methodsFor:'accessing'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14129
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14130
defaultPriority
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14131
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14132
    |defaultPriority|
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14133
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14134
    Error handle:[:ex |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14135
	Transcript showCR: 'PrinterInfo2 error getting defaultPriority - ', ex description.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14136
	defaultPriority := 0.
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14137
    ] do:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14138
	defaultPriority := self unsignedLongAt:(60 + 1)
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14139
    ].
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14140
    ^ defaultPriority
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14141
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14142
    "Created: / 01-08-2006 / 12:46:50 / fm"
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14143
    "Modified: / 16-04-2007 / 13:08:33 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14144
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14145
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14146
pComment
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14147
    |pComment|
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14148
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14149
    Error handle:[:ex |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14150
	Transcript showCR: 'PrinterInfo2 error getting pComment - ', ex description.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14151
	pComment := 0.
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14152
    ] do:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14153
	pComment := self unsignedLongAt:(20 + 1).
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14154
    ].
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14155
10627
bef737d1b8a7 care for -1 fd returned by CreatePipe
Claus Gittinger <cg@exept.de>
parents: 10622
diff changeset
 14156
    ^ pComment == 0
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14157
	ifTrue:''
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14158
	ifFalse:[ (ExternalBytes address:pComment) stringAt:1 ]
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14159
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14160
    "Created: / 01-08-2006 / 14:02:55 / fm"
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14161
    "Modified: / 16-04-2007 / 13:08:39 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14162
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14163
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14164
pDriverName
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14165
    |pName|
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14166
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14167
    Error handle:[:ex |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14168
	Transcript showCR: 'PrinterInfo2 error getting pDriverName - ', ex description.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14169
	pName := 0.
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14170
    ] do:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14171
	pName := self unsignedLongAt:(16 + 1).
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14172
    ].
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14173
    pName == 0 ifTrue:[^ ''].
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14174
    ^ (ExternalBytes address:pName) stringAt:1
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14175
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14176
    "Created: / 01-08-2006 / 14:05:18 / fm"
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14177
    "Modified: / 16-04-2007 / 13:08:43 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14178
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14179
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14180
pLocation
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14181
    |pLocation externalBytes|
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14182
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14183
    Error handle:[:ex |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14184
	Transcript showCR: 'PrinterInfo2 error getting pLocation - ', ex description.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14185
	pLocation := 0.
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14186
    ] do:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14187
	pLocation := self unsignedLongAt:(24 + 1).
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14188
    ].
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14189
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14190
    pLocation == 0 ifTrue:[^ nil].
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14191
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14192
    externalBytes := ExternalBytes address:pLocation.
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 14193
    ^ externalBytes isEmpty
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14194
	ifTrue:[ nil ]
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14195
	ifFalse:[ externalBytes stringAt:1 ]
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14196
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14197
    "Created: / 01-08-2006 / 14:03:21 / fm"
10098
7cb05f4cac0b *** empty log message ***
fm
parents: 10026
diff changeset
 14198
    "Modified: / 18-10-2006 / 12:06:45 / User"
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14199
    "Modified: / 16-04-2007 / 13:08:27 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14200
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14201
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14202
priority
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14203
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14204
    |priority|
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14205
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14206
    Error handle:[:ex |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14207
	Transcript showCR: 'PrinterInfo2 error getting priority - ', ex description.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14208
	priority := 0.
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14209
    ] do:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14210
	priority := self unsignedLongAt: 56 + 1
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14211
    ].
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14212
    ^ priority
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14213
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14214
    "Created: / 01-08-2006 / 14:40:08 / fm"
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14215
    "Modified: / 16-04-2007 / 13:09:02 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14216
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14217
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14218
status
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14219
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14220
    |status|
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14221
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14222
    Error handle:[:ex |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14223
	Transcript showCR: 'PrinterInfo2 error getting status - ', ex description.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14224
	status := -1.
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14225
    ] do:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14226
	status := self unsignedLongAt: 72 + 1
11402
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14227
    ].
9444b3f90a00 error handle for PrinterInfo2 structure
fm
parents: 11344
diff changeset
 14228
    ^ status
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14229
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14230
    "Created: / 31-07-2006 / 11:08:05 / fm"
10511
7a6490a1af87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 10465
diff changeset
 14231
    "Modified: / 16-04-2007 / 13:08:59 / cg"
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14232
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 14233
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14234
!Win32OperatingSystem::RegistryEntry class methodsFor:'defaults'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14235
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14236
rootKeyNames
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14237
    "returns a collection of root keyNames"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14238
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14239
    ^ #(
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14240
	'HKEY_CLASSES_ROOT'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14241
	'HKEY_CURRENT_USER'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14242
	'HKEY_LOCAL_MACHINE'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14243
	'HKEY_USERS'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14244
	'HKEY_PERFORMANCE_DATA'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14245
	'HKEY_CURRENT_CONFIG'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14246
	'HKEY_DYN_DATA'
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14247
      )
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14248
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14249
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14250
separator
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14251
    "returns the registry-key-path separator character"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14252
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14253
    ^$\
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14254
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14255
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14256
!Win32OperatingSystem::RegistryEntry class methodsFor:'documentation'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14257
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14258
documentation
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14259
"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14260
    Interface to a WIN32 registry.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14261
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14262
    As this is a private class, access it via
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14263
	Win32OperatingSystem registryEntry
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14264
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14265
    [author:]
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14266
	Claus Gittinger (initial version & cleanup)
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14267
"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14268
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14269
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14270
examples
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14271
"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14272
    retrieve an existing entry by key:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14273
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14274
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14275
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14276
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14277
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14278
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14279
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14280
    retrieve a non-existing entry by key:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14281
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14282
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14283
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14284
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\xxx'
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14285
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14286
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14287
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14288
    ask a keys value:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14289
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14290
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14291
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14292
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14293
	Transcript show:'Windows serial NR:'; showCR:(k valueNamed:'ProductId').
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14294
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14295
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14296
	Transcript showCR:(k valueNamed:'CurrentVersion').
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14297
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14298
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14299
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14300
    create a sub-key (if not already present):
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14301
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14302
	|k subKey|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14303
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14304
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14305
	subKey := k createSubKeyNamed:'RegistryDemo'
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14306
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14307
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14308
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14309
    change a keys value:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14310
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14311
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14312
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14313
	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
 14314
	k valueNamed:'FooBarBaz' put:'a foo bar baz string'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14315
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14316
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14317
    delete a value:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14318
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14319
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14320
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14321
	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
 14322
	k deleteValueNamed:'FooBarBaz'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14323
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14324
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14325
    delete a key:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14326
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14327
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14328
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14329
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14330
	k deleteSubKeyNamed:'RegistryDemo'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14331
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14332
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14333
    enumerate keys:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14334
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14335
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14336
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14337
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14338
	k subKeysDo:[:subKey |
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14339
	    Transcript showCR:subKey path
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14340
	]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14341
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14342
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14343
    enumerate all keys (recursive):
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14344
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14345
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14346
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14347
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14348
	k allSubKeysDo:[:subKey |
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14349
	    Transcript showCR:subKey path
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14350
	]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14351
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14352
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14353
    fetch value by index:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14354
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14355
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14356
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14357
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14358
	Transcript showCR:(k valueNameAtIndex:0)
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14359
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14360
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14361
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14362
    enumerate value names:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14363
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14364
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14365
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14366
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14367
	k valueNamesDo:[:nm  |
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14368
	   Transcript showCR:nm.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14369
	]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14370
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14371
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14372
    enumerate values:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14373
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14374
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14375
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14376
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14377
	k valueNamesAndValuesDo:[:nm :val |
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14378
	    Transcript showCR:(nm , ' -> ' , val storeString).
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14379
	]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14380
									[exEnd]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14381
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14382
    search for a value (where does NT store the domain ?):
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14383
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14384
	|k|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14385
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14386
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\System'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14387
	k subKeysDo:[:subKey |
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14388
	    subKey subKeysDo:[:subSubKey |
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14389
		|tcp params|
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14390
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14391
		(subSubKey path asLowercase endsWith:'services') ifTrue:[
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14392
		    tcp := subSubKey subKeyNamed:'tcpip'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14393
		    tcp notNil ifTrue:[
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14394
			params := tcp subKeyNamed:'parameters'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14395
			params notNil ifTrue:[
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14396
			    Transcript showCR:'Domain is found in ' , params path ,
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14397
					' value: ' , (params valueNamed:'Domain').
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14398
			    params close.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14399
			].
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14400
			tcp close.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14401
		    ]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14402
		]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14403
	    ]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14404
	]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14405
									[exEnd]
14514
e45969ab90ac class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14449
diff changeset
 14406
    register an exe for shell-open:
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14407
									[exBegin]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14408
	|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
 14409
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14410
	k := Win32OperatingSystem registryEntry key:'HKEY_CURRENT_USER\Software\Classes\Applications'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14411
	stx := k createSubKeyNamed:'SmalltalkX.exe'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14412
	shell := stx createSubKeyNamed:'shell'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14413
	open := shell createSubKeyNamed:'open'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14414
	cmd := open createSubKeyNamed:'command'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14415
	cmd defaultValue:(Character doubleQuote asString,OperatingSystem nameOfSTXExecutable,Character doubleQuote,
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14416
			 ' ',Character doubleQuote,'%1',Character doubleQuote).
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14417
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14418
	k := Win32OperatingSystem registryEntry key:'HKEY_CURRENT_USER\Software\Classes'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14419
	st_af := k createSubKeyNamed:'st_auto_file'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14420
	shell := st_af createSubKeyNamed:'shell'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14421
	open := shell createSubKeyNamed:'open'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14422
	cmd := open createSubKeyNamed:'command'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14423
	cmd defaultValue:(Character doubleQuote asString,OperatingSystem nameOfSTXExecutable,Character doubleQuote,
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14424
			 ' --open ',Character doubleQuote,'%1',Character doubleQuote).
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14425
	edit := shell createSubKeyNamed:'edit'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14426
	cmd := edit createSubKeyNamed:'command'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14427
	cmd defaultValue:(Character doubleQuote asString,OperatingSystem nameOfSTXExecutable,Character doubleQuote,
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14428
			 ' --edit ',Character doubleQuote,'%1',Character doubleQuote).
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14429
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14430
	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
 14431
	st := k createSubKeyNamed:'.st'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14432
	owl := st createSubKeyNamed:'OpenWithList'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14433
	list := owl valueNames.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14434
	(list contains:[:k | (owl valueNamed:k) = 'SmalltalkX.exe']) ifTrue:[
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14435
	    Transcript showCR:'already registered.'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14436
	] ifFalse:[
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14437
	    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
 14438
	    owl valueNamed:id asString put:'SmalltalkX.exe'.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14439
	]
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 14440
									[exEnd]
14514
e45969ab90ac class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14449
diff changeset
 14441
e45969ab90ac class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14449
diff changeset
 14442
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14443
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14444
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14445
"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14446
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14447
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14448
!Win32OperatingSystem::RegistryEntry class methodsFor:'initialization'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14449
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14450
initialize
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14451
    Lobby := Registry new.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14452
    ObjectMemory addDependent:self.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14453
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14454
    HKEY_CLASSES_ROOT     := %{ __MKEXTERNALADDRESS(HKEY_CLASSES_ROOT) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14455
    HKEY_CURRENT_USER     := %{ __MKEXTERNALADDRESS(HKEY_CURRENT_USER) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14456
    HKEY_LOCAL_MACHINE    := %{ __MKEXTERNALADDRESS(HKEY_LOCAL_MACHINE) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14457
    HKEY_USERS            := %{ __MKEXTERNALADDRESS(HKEY_USERS) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14458
    HKEY_PERFORMANCE_DATA := %{ __MKEXTERNALADDRESS(HKEY_PERFORMANCE_DATA) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14459
    HKEY_CURRENT_CONFIG   := %{ __MKEXTERNALADDRESS(HKEY_CURRENT_CONFIG) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14460
    HKEY_DYN_DATA         := %{ __MKEXTERNALADDRESS(HKEY_DYN_DATA) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14461
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14462
%{
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14463
#ifndef HKEY_PERFORMANCE_TEXT
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14464
    /* sigh - not defined with borland-cc */
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14465
# define HKEY_PERFORMANCE_TEXT  (( HKEY ) (ULONG_PTR)((LONG)0x80000050) )
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14466
#endif
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14467
#ifndef HKEY_PERFORMANCE_NLSTEXT
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14468
    /* sigh - not defined with borland-cc */
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14469
# define HKEY_PERFORMANCE_NLSTEXT  (( HKEY ) (ULONG_PTR)((LONG)0x80000060) )
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14470
#endif
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14471
%}.
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14472
    HKEY_PERFORMANCE_TEXT    := %{ __MKEXTERNALADDRESS(HKEY_PERFORMANCE_TEXT) %}.
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14473
    HKEY_PERFORMANCE_NLSTEXT := %{ __MKEXTERNALADDRESS(HKEY_PERFORMANCE_NLSTEXT) %}.
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14474
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14475
    "
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14476
     self initialize
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14477
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14478
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14479
    "Created: / 19.5.1999 / 21:39:57 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14480
    "Modified: / 19.5.1999 / 22:45:31 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14481
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14482
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14483
rootKeyValueFor:specialKeyStringOrSymbol
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14484
    "returns one of the root keys or nil
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14485
     (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
 14486
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14487
    HKEY_CLASSES_ROOT isNil ifTrue:[self initialize].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14488
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14489
    specialKeyStringOrSymbol = #'HKEY_CLASSES_ROOT' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14490
	^ HKEY_CLASSES_ROOT.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14491
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14492
    specialKeyStringOrSymbol = #'HKEY_CURRENT_USER' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14493
	^ HKEY_CURRENT_USER.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14494
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14495
    specialKeyStringOrSymbol = #'HKEY_LOCAL_MACHINE' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14496
	^ HKEY_LOCAL_MACHINE.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14497
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14498
    specialKeyStringOrSymbol = #'HKEY_USERS' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14499
	^ HKEY_USERS.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14500
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14501
    specialKeyStringOrSymbol = #'HKEY_PERFORMANCE_DATA' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14502
	^ HKEY_PERFORMANCE_DATA.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14503
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14504
    specialKeyStringOrSymbol = #'HKEY_CURRENT_CONFIG' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14505
	^ HKEY_CURRENT_CONFIG.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14506
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14507
    specialKeyStringOrSymbol = #'HKEY_DYN_DATA' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14508
	^ HKEY_DYN_DATA.
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14509
    ].
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14510
    specialKeyStringOrSymbol = #'HKEY_PERFORMANCE_TEXT' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14511
	^ HKEY_PERFORMANCE_TEXT.
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14512
    ].
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 14513
    specialKeyStringOrSymbol = #'HKEY_PERFORMANCE_NLSTEXT' ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14514
	^ HKEY_PERFORMANCE_NLSTEXT.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14515
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14516
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14517
    ^ nil
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14518
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14519
    "Created: / 19.5.1999 / 21:40:30 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14520
    "Modified: / 24.12.1999 / 00:02:06 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14521
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14522
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14523
update:something with:aParameter from:changedObject
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14524
    "handle image restarts and refetch registry handles"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14525
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14526
    (something == #returnFromSnapshot) ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14527
	self initialize
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14528
    ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14529
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14530
    "Created: 15.6.1996 / 15:14:03 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14531
    "Modified: 24.2.1997 / 22:08:05 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14532
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14533
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14534
!Win32OperatingSystem::RegistryEntry class methodsFor:'instance creation'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14535
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 14536
immediateHandle:aHandleValue
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 14537
    |h newEntry|
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 14538
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 14539
    aHandleValue isInteger ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14540
	h := ExternalAddress newAddress:aHandleValue
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 14541
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14542
	h := aHandleValue
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 14543
    ].
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 14544
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 14545
    "/ rootKeys are not registered for RegClose ...
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 14546
    newEntry := self basicNew setHandle:h path:nil.
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 14547
    newEntry registerForFinalization.
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 14548
    ^ newEntry.
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 14549
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 14550
    "
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 14551
     RegistryEntry immediateHandle:16r80000002
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 14552
    "
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 14553
!
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 14554
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14555
key:aKeyNamePath
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14556
    "retrieve an entry by full path name (starting at a root)"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14557
13224
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 14558
    ^ self key:aKeyNamePath createIfAbsent:false
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 14559
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 14560
    "
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 14561
     self key:'HKEY_LOCAL_MACHINE'
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 14562
     self key:'HKEY_LOCAL_MACHINE\Software'
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 14563
     self key:'HKEY_LOCAL_MACHINE\Software\Borland\'
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 14564
     self key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\3.2.5\Directory'
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 14565
     (self key:'HKEY_CLASSES_ROOT\MicrosoftWorks.WordProcessor\CLSID') valueNamed:''
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 14566
    "
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 14567
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 14568
    "Modified: / 19-01-2011 / 15:59:36 / cg"
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 14569
!
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 14570
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 14571
key:aKeyNamePath createIfAbsent:createIfAbsent
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 14572
    "retrieve an entry by full path name (starting at a root)"
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 14573
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14574
    |idx first rest root|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14575
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14576
    HKEY_CLASSES_ROOT isNil ifTrue:[self initialize].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14577
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14578
    idx := aKeyNamePath indexOf:(self separator).
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14579
    idx == 0 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14580
	first := aKeyNamePath.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14581
	rest := nil.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14582
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14583
	first := aKeyNamePath copyTo:idx-1.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14584
	rest := aKeyNamePath copyFrom:idx+1
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14585
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14586
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14587
    first := first asUppercase.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14588
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14589
    "/ the first is a pseudo name
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14590
    root := self rootKey:first.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14591
    root isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14592
	^ nil
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14593
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14594
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14595
    rest size == 0 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14596
	^ root
10758
36af354a5b4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10757
diff changeset
 14597
    ].
36af354a5b4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10757
diff changeset
 14598
36af354a5b4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10757
diff changeset
 14599
    Error handle:[:ex |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14600
	^ nil
10758
36af354a5b4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10757
diff changeset
 14601
    ] do:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14602
	^ root subKeyNamed:rest createIfAbsent:createIfAbsent.
10758
36af354a5b4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10757
diff changeset
 14603
    ].
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14604
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14605
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14606
     self key:'HKEY_LOCAL_MACHINE'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14607
     self key:'HKEY_LOCAL_MACHINE\Software'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14608
     self key:'HKEY_LOCAL_MACHINE\Software\Borland\'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14609
     self key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\3.2.5\Directory'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14610
     (self key:'HKEY_CLASSES_ROOT\MicrosoftWorks.WordProcessor\CLSID') valueNamed:''
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14611
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14612
13224
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 14613
    "Created: / 19-01-2011 / 15:59:21 / cg"
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14614
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14615
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14616
rootKey:aRootKeyStringOrSymbol
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14617
    "retrieve one of the root entries by name"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14618
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14619
    |keyVal|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14620
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14621
    keyVal := self rootKeyValueFor:aRootKeyStringOrSymbol.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14622
    keyVal isNil ifTrue:[^ nil].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14623
    "/ rootKeys are not registered for RegClose ...
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14624
    ^ self basicNew setHandle:keyVal path:aRootKeyStringOrSymbol.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14625
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14626
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14627
     RegistryEntry rootKey:#'HKEY_LOCAL_MACHINE'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14628
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14629
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14630
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14631
!Win32OperatingSystem::RegistryEntry class methodsFor:'misc queries'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14632
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14633
classIDOf:applicationName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14634
    |k clsIDString|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14635
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14636
    k := self key:'HKEY_CLASSES_ROOT\',applicationName,'\CLSID'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14637
    k isNil ifTrue:[ ^ nil ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14638
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14639
    clsIDString := k defaultValue.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14640
    k close.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14641
    ^ UUID fromString:clsIDString
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14642
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14643
    "
9170
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
 14644
     self classIDOf:'MicrosoftWorks.WordProcessor'
9167
aaf9ce008153 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9166
diff changeset
 14645
     self classIDOf:'AcroPDF.PDF'
aaf9ce008153 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9166
diff changeset
 14646
     self classIDOf:'PDF.PdfCtrl.5'
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14647
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14648
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14649
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14650
commandTemplateToOpenMimeType:mimeType
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14651
    "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
 14652
     Return nil, if no such application is known.
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14653
     Do nor use directly - this is a helper for MIMEType"
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14654
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14655
    ^ self commandTemplateToOpenSuffix:(self extensionForMimeType:mimeType)
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14656
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14657
    "
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14658
     Win32OperatingSystem::RegistryEntry commandTemplateToOpenMimeType:'application/pdf'
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14659
     Win32OperatingSystem::RegistryEntry commandTemplateToOpenMimeType:'audio/mp3'
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14660
     Win32OperatingSystem::RegistryEntry commandTemplateToOpenMimeType:'video/avi'
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14661
     Win32OperatingSystem::RegistryEntry commandTemplateToOpenMimeType:'application/x-zip-compressed'
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14662
    "
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14663
!
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14664
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14665
commandTemplateToOpenSuffix:suffixArg
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14666
    "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
 14667
     Do nor use directly - this is a helper for MIMEType"
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14668
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14669
    ^ self shellCommandTemplateFor:'open' onSuffix:suffixArg
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14670
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14671
    "
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14672
     self commandTemplateToOpenSuffix:'pdf'
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14673
     self commandTemplateToOpenSuffix:'zip'
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14674
    "
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14675
!
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14676
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14677
commandTemplateToPrintMimeType:mimeType
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14678
    "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
 14679
     Return nil, if no such application is known.
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14680
     Do nor use directly - this is a helper for MIMEType"
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14681
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14682
    ^ self commandTemplateToPrintSuffix:(self extensionForMimeType:mimeType)
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14683
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14684
    "
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 14685
     Win32OperatingSystem::RegistryEntry commandTemplateToPrintMimeType:'application/pdf'
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 14686
     Win32OperatingSystem::RegistryEntry commandTemplateToPrintMimeType:'audio/mp3'
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14687
    "
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14688
!
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14689
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14690
commandTemplateToPrintSuffix:suffixArg
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14691
    "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
 14692
     Do nor use directly - this is a helper for MIMEType"
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14693
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14694
    ^ self shellCommandTemplateFor:'print' onSuffix:suffixArg
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14695
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14696
    "
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 14697
     self commandTemplateToPrintSuffix:'pdf'
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 14698
     self commandTemplateToPrintSuffix:'zip'
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14699
    "
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14700
!
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14701
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14702
executableForMimeType:mimeType
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14703
    "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
 14704
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14705
    <resource: #obsolete>
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14706
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14707
    self obsoleteMethodWarning:'use commandTemplateToOpenMimeType:'.
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14708
    ^ self commandTemplateToOpenMimeType:mimeType
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14709
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14710
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14711
     Win32OperatingSystem::RegistryEntry executableForMimeType:'application/pdf'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14712
     Win32OperatingSystem::RegistryEntry executableForMimeType:'audio/mp3'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14713
     Win32OperatingSystem::RegistryEntry executableForMimeType:'video/avi'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14714
     Win32OperatingSystem::RegistryEntry executableForMimeType:'application/x-zip-compressed'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14715
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14716
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14717
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14718
executableForSuffix:suffixArg
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14719
    "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
 14720
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14721
    <resource: #obsolete>
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14722
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14723
    self obsoleteMethodWarning:'use commandTemplateToOpenSuffix:'.
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14724
    ^ self commandTemplateToOpenSuffix:suffixArg.
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14725
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14726
    "
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 14727
     self executableForSuffix:'pdf'
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14728
     self executableForSuffix:'zip'
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14729
    "
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14730
!
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14731
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14732
extensionForMimeType:mimeType
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14733
    "HELPER: given a mimeType, retrieve the file extension or nil (if unknown)"
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14734
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14735
    |k suffix|
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14736
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14737
    k := self key:'HKEY_CLASSES_ROOT\MIME\Database\Content Type\',mimeType.
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14738
    k notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14739
	suffix := k valueNamed:'extension'.
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14740
    ].
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14741
    ^ suffix
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14742
!
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14743
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14744
shellCommandTemplateFor:operation onSuffix:suffixArg
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14745
    "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
 14746
9257
e0554fbd09d3 added redirect for RegistryEntry
sr
parents: 9255
diff changeset
 14747
    |k fkey cmd suffix redirect|
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14748
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14749
    suffix := suffixArg.
9212
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14750
    suffix isNil ifTrue:[^ nil].
1ffd975f9e58 commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 9210
diff changeset
 14751
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14752
    (suffix startsWith:'.') ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14753
	suffix := suffix copyFrom:2
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14754
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14755
    k := self key:'HKEY_CLASSES_ROOT\.',suffix.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14756
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14757
    k notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14758
	fkey := (k valueNamed:'').
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14759
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14760
    fkey isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14761
	fkey := suffix,'_auto_file'
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14762
    ].
9257
e0554fbd09d3 added redirect for RegistryEntry
sr
parents: 9255
diff changeset
 14763
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14764
    fkey notEmptyOrNil ifTrue:[
9257
e0554fbd09d3 added redirect for RegistryEntry
sr
parents: 9255
diff changeset
 14765
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14766
	redirect := nil.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14767
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14768
	k := Win32OperatingSystem::RegistryEntry key:('HKEY_CLASSES_ROOT\' , fkey , '\CurVer').
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14769
	k notNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14770
	    redirect := k defaultValue
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14771
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14772
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14773
	redirect isNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14774
	     k := Win32OperatingSystem::RegistryEntry key:('HKEY_CLASSES_ROOT\' , (fkey) , '\shell\',operation,'\command').
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14775
	] ifFalse:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14776
	     k := Win32OperatingSystem::RegistryEntry key:('HKEY_CLASSES_ROOT\' , (redirect) , '\shell\',operation,'\command').
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14777
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14778
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14779
	k notNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14780
	    cmd := k defaultValue
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14781
	].
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 14782
    ].
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 14783
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 14784
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 14785
    ^ cmd
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14786
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14787
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14788
!Win32OperatingSystem::RegistryEntry class methodsFor:'registry access'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14789
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14790
stringValueFor:valueName atKey:keyPath
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14791
    "convenient accessing method;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14792
     Looks for a string value under keyPath;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14793
     returns nil if either not found, or no string value"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14794
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14795
    |k v|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14796
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14797
    k := self key:keyPath.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14798
    k isNil ifTrue:[^ nil].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14799
    v := k valueNamed:valueName.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14800
    k close.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14801
    v isString ifFalse:[^ nil].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14802
    ^ v
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14803
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14804
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14805
     self
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14806
	stringValueFor:'Content Type'
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14807
	atKey:'HKEY_CLASSES_ROOT\.au'
9155
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 14808
    "
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 14809
! !
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 14810
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14811
!Win32OperatingSystem::RegistryEntry methodsFor:'accessing'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14812
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 14813
handleValue
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 14814
    ^ handle address
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 14815
!
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 14816
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14817
name
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14818
    "return the keys name component (subKey name within my
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14819
     parent key)"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14820
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14821
    |idx|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14822
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14823
    idx := path lastIndexOf:(self class separator).
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14824
    idx == 0 ifTrue:[^ path].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14825
    ^ path copyFrom:idx+1
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14826
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14827
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14828
path
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14829
    "return the keys full key path name"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14830
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14831
    ^ path.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14832
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14833
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14834
!Win32OperatingSystem::RegistryEntry methodsFor:'accessing subkeys'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14835
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14836
createSubKeyNamed:subKeyString
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14837
    "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
 14838
     If it already exists, return it.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14839
     Return nil if the new key cannot be created."
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14840
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 14841
    |newEntry subHandle errorNumber|
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14842
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14843
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14844
    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
 14845
    int _retVal;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14846
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14847
    if (__isExternalAddressLike(__INST(handle))
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
 14848
     && __isStringLike(subKeyString)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14849
	myKey = (HKEY)__externalAddressVal(__INST(handle));
13780
2f055d86569e visual c compilability
Claus Gittinger <cg@exept.de>
parents: 13778
diff changeset
 14850
	if ((_retVal = RegCreateKeyA(myKey, __stringVal(subKeyString), &subKey)) == ERROR_SUCCESS) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14851
	    subHandle = __MKEXTERNALADDRESS(subKey);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14852
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14853
	    if ((_retVal != ERROR_PATH_NOT_FOUND)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14854
	     && (_retVal != ERROR_FILE_NOT_FOUND)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14855
		errorNumber = __MKSMALLINT(_retVal);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14856
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14857
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14858
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14859
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14860
    subHandle notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14861
	newEntry := self class basicNew
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14862
			setHandle:subHandle
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14863
			path:(path , self class separator asString , subKeyString).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14864
	newEntry registerForFinalization.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14865
	^ newEntry.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14866
    ].
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 14867
    errorNumber notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14868
	(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
 14869
    ].
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14870
    ^ nil
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14871
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14872
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14873
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14874
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14875
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14876
     sub := top createSubKeyNamed:'FooBarBaz'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14877
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14878
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14879
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14880
deleteSubKeyNamed:subKeyString
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14881
    "delete a key below mySelf.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14882
     Return true on success."
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14883
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 14884
    |errorNumber|
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 14885
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14886
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14887
    HKEY myKey;
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 14888
    int _retVal;
9156
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
    if (__isExternalAddressLike(__INST(handle))
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
 14891
     && __isStringLike(subKeyString)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14892
	myKey = (HKEY)__externalAddressVal(__INST(handle));
13780
2f055d86569e visual c compilability
Claus Gittinger <cg@exept.de>
parents: 13778
diff changeset
 14893
	if ((_retVal = RegDeleteKeyA(myKey, __stringVal(subKeyString))) == ERROR_SUCCESS) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14894
	    RETURN (true);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14895
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14896
	if ((_retVal != ERROR_PATH_NOT_FOUND)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14897
	 && (_retVal != ERROR_FILE_NOT_FOUND)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14898
	    errorNumber = __MKSMALLINT(_retVal);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14899
	}
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 14900
    }
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 14901
%}.
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 14902
    errorNumber notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14903
	(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
 14904
    ].
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14905
    ^ false
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
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14908
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14909
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14910
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14911
     sub := top createSubKeyNamed:'FooBarBaz'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14912
     top deleteSubKeyNamed:'FooBarBaz'.
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
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14916
remoteKeyOnHost:hostName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14917
    "return the corresponding registry entry from
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14918
     a remote computers registry."
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14919
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 14920
    |newEntry remoteHandle errorNumber|
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
    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
 14924
    int _retVal;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14925
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
 14926
    if (__isExternalAddressLike(__INST(handle)) && __isStringLike(hostName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14927
	myKey = (HKEY)__externalAddressVal(__INST(handle));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14928
	if ((_retVal = RegConnectRegistryA(__stringVal(hostName), myKey, &remoteKey)) == ERROR_SUCCESS) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14929
	    remoteHandle = __MKEXTERNALADDRESS(remoteKey);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14930
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14931
	    if ((_retVal != ERROR_PATH_NOT_FOUND)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14932
	     && (_retVal != ERROR_FILE_NOT_FOUND)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14933
		errorNumber = __MKSMALLINT(_retVal);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14934
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14935
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14936
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14937
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14938
    remoteHandle notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14939
	newEntry := self class basicNew setHandle:remoteHandle path:path.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14940
	newEntry registerForFinalization.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14941
	^ newEntry.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14942
    ].
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 14943
    errorNumber notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14944
	(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
 14945
    ].
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14946
    ^ nil
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14947
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14948
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14949
     |top remote|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14950
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14951
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14952
     remote := top remoteKeyOnHost:'BETTI'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14953
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14954
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14955
     |top remote|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14956
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14957
     top := self key:'HKEY_USERS'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14958
     remote := top remoteKeyOnHost:'BETTI'
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
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14961
     |top remote|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14962
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14963
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14964
     remote := top remoteKeyOnHost:'JOSHUA'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14965
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14966
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14967
     |top remote|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14968
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14969
     top := self key:'HKEY_USERS'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14970
     remote := top remoteKeyOnHost:'JOSHUA'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14971
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14972
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14973
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14974
subKeyAtIndex:subKeyIndex
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14975
    "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
 14976
     Return nil if no such key exists"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14977
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 14978
    |subKeyName subKeyClassName errorNumber|
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14979
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14980
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14981
    HKEY myKey, subKey = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14982
    char nameBuffer[256];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14983
    DWORD nameSize = sizeof(nameBuffer) - 1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14984
    char classNameBuffer[256];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14985
    DWORD classNameSize = sizeof(classNameBuffer) - 1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14986
    FILETIME modificationTime;
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 14987
    int _retVal;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14988
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14989
    if (__isExternalAddressLike(__INST(handle))
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 14990
     && __isSmallInteger(subKeyIndex)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14991
	myKey = (HKEY)__externalAddressVal(__INST(handle));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14992
	if ((_retVal = RegEnumKeyExA(myKey, __intVal(subKeyIndex),
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14993
			 nameBuffer, &nameSize,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14994
			 NULL,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14995
			 classNameBuffer, &classNameSize,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14996
			 &modificationTime)) == ERROR_SUCCESS) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14997
	    nameBuffer[nameSize] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14998
	    classNameBuffer[classNameSize] = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 14999
	    subKeyName = __MKSTRING(nameBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15000
	    subKeyClassName = __MKSTRING(classNameBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15001
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15002
	    if ((_retVal != ERROR_PATH_NOT_FOUND)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15003
	     && (_retVal != ERROR_FILE_NOT_FOUND)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15004
	     && (_retVal != ERROR_NO_MORE_ITEMS)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15005
		errorNumber = __MKSMALLINT(_retVal);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15006
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15007
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15008
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15009
%}.
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15010
    subKeyName notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15011
	^ self subKeyNamed:subKeyName.
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15012
    ].
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15013
    errorNumber notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15014
	(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
 15015
    ].
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15016
    ^ nil
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15017
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15018
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15019
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15020
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15021
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15022
     sub := top subKeyAtIndex:0
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15023
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15024
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15025
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15026
subKeyNamed:subKeyString
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15027
    "return a new registry entry below mySelf with the given subKey.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15028
     Return nil if no such key exists"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15029
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15030
    |newEntry subHandle errorNumber|
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15031
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15032
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15033
    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
 15034
    int _retVal;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15035
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15036
    if (__isExternalAddressLike(__INST(handle))
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
 15037
     && __isStringLike(subKeyString)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15038
	myKey = (HKEY)__externalAddressVal(__INST(handle));
13780
2f055d86569e visual c compilability
Claus Gittinger <cg@exept.de>
parents: 13778
diff changeset
 15039
	_retVal = RegOpenKeyA(myKey, __stringVal(subKeyString), &subKey);
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15040
	if (_retVal == ERROR_SUCCESS) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15041
	    subHandle = __MKEXTERNALADDRESS(subKey);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15042
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15043
	    if ((_retVal != ERROR_PATH_NOT_FOUND)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15044
	     && (_retVal != ERROR_FILE_NOT_FOUND)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15045
		errorNumber = __MKSMALLINT(_retVal);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15046
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15047
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15048
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15049
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15050
    subHandle notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15051
	newEntry := self class basicNew
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15052
			setHandle:subHandle
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15053
			path:((path ? '?') , self class separator asString , subKeyString).
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15054
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15055
	newEntry registerForFinalization.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15056
	^ newEntry.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15057
    ].
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15058
    errorNumber notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15059
	(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
 15060
    ].
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15061
    ^ nil
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15062
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15063
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15064
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15065
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15066
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15067
     sub := top subKeyNamed:'Software'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15068
    "
13224
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15069
!
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15070
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15071
subKeyNamed:subKeyString createIfAbsent:createIfAbsent
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15072
    "return a new registry entry below mySelf with the given subKey.
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15073
     If no such key exists and createIfAbsent is true, the key is created.
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15074
     Otherwise, nil is returned"
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15075
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15076
    |k|
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15077
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15078
    (k := self subKeyNamed:subKeyString) isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15079
	createIfAbsent ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15080
	    ^ self createSubKeyNamed:subKeyString
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15081
	].
13224
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15082
    ].
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15083
    ^ k
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15084
Claus Gittinger <cg@exept.de>
parents: 13223
diff changeset
 15085
    "Created: / 19-01-2011 / 15:58:45 / cg"
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15086
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15087
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15088
!Win32OperatingSystem::RegistryEntry methodsFor:'accessing values'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15089
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15090
defaultValue
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15091
    ^ self valueNamed:''
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15092
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15093
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15094
     (self key:'HKEY_CLASSES_ROOT\MicrosoftWorks.WordProcessor\CLSID') defaultValue
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15095
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15096
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15097
11623
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15098
defaultValue:datum
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15099
    "store a value; the value type depends upon the stored value:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15100
	ByteArray       -> REG_BINARY
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15101
	String          -> REG_SZ
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15102
	Array of string -> REG_MULTI_SZ
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15103
	Integer         -> REG_DWORD
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15104
	nil             -> REG_NONE
11623
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15105
    "
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15106
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15107
    ^ self valueNamed:'' put:datum
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15108
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15109
    "
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15110
     (self key:'HKEY_CLASSES_ROOT\MicrosoftWorks.WordProcessor\CLSID') defaultValue
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15111
    "
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15112
!
c767911bff13 + defaultValue: in registry
Claus Gittinger <cg@exept.de>
parents: 11617
diff changeset
 15113
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15114
deleteValueNamed:aValueName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15115
    "delete a value.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15116
     Return true on success."
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15117
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15118
    |errorNumber|
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15119
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15120
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15121
    HKEY myKey;
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15122
    int _retVal;
9156
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
    if (__isExternalAddressLike(__INST(handle))
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
 15125
     && __isStringLike(aValueName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15126
	myKey = (HKEY)__externalAddressVal(__INST(handle));
13780
2f055d86569e visual c compilability
Claus Gittinger <cg@exept.de>
parents: 13778
diff changeset
 15127
	if ((_retVal = RegDeleteValueA(myKey, __stringVal(aValueName))) == ERROR_SUCCESS) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15128
	    RETURN (true);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15129
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15130
	if ((_retVal != ERROR_PATH_NOT_FOUND)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15131
	 && (_retVal != ERROR_FILE_NOT_FOUND)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15132
	    errorNumber = __MKSMALLINT(_retVal);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15133
	}
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15134
    }
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15135
%}.
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15136
    errorNumber notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15137
	(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
 15138
    ].
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15139
    ^ false
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15140
!
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
valueNameAtIndex:valueIndex
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15143
    "return a values name for the given value index.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15144
     Return nil if no such value exists"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15145
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15146
    |valueName errorNumber|
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15147
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15148
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15149
    HKEY myKey;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15150
    char nameBuffer[256];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15151
    DWORD nameSize = sizeof(nameBuffer) - 1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15152
    DWORD valueType;
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15153
    int _retVal;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15154
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15155
    if (__isExternalAddressLike(__INST(handle))
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15156
     && __isSmallInteger(valueIndex)) {
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15157
	myKey = (HKEY)__externalAddressVal(__INST(handle));
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15158
	if ((_retVal = RegEnumValueA(myKey, __intVal(valueIndex),
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15159
			 nameBuffer, &nameSize,
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15160
			 NULL,
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15161
			 &valueType,
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15162
			 NULL, NULL)) == ERROR_SUCCESS) {
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15163
	    nameBuffer[nameSize] = '\0';
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15164
	    valueName = __MKSTRING(nameBuffer);
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15165
	} else {
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15166
	    if ((_retVal != ERROR_PATH_NOT_FOUND)
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15167
	     && (_retVal != ERROR_FILE_NOT_FOUND)
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15168
	     && (_retVal != ERROR_NO_MORE_ITEMS)) {
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15169
		errorNumber = __MKSMALLINT(_retVal);
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15170
	    }
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15171
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15172
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15173
%}.
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15174
    errorNumber notNil ifTrue:[
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15175
	(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
 15176
    ].
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15177
    ^ valueName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15178
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15179
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15180
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15181
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15182
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15183
     sub := top subKeyAtIndex:0
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15184
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15185
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15186
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15187
valueNamed:aValueName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15188
    "retrieve a value; the returned object depends upon the type:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15189
	REG_BINARY      -> ByteArray
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15190
	REG_SZ          -> String
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15191
	REG_MULTI_SZ    -> Array of strings
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15192
	REG_DWORD       -> Integer
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15193
	REG_NONE        -> nil
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15194
    "
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15195
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15196
    |stringArray retVal errorNumber|
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15197
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15198
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15199
    HKEY myKey;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15200
    DWORD valueType;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15201
    union {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15202
	DWORD dWord;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15203
	unsigned char dWordBytes[4];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15204
	unsigned char smallDataBuffer[1024*128];
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15205
    } quickData;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15206
    int val;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15207
    DWORD dataSize = sizeof(quickData);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15208
    unsigned char *dataBuffer = NULL;
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15209
#define xxUSE_UNICODE
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15210
#ifdef USE_UNICODE
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15211
# define xRegQueryValueEx  RegQueryValueExW
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 15212
# define CHAR             short
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15213
#else
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15214
# define RegQueryValueEx  RegQueryValueExA
10754
60d9becc81ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10752
diff changeset
 15215
# define CHAR             char
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15216
#endif
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15217
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15218
    if (__isExternalAddressLike(__INST(handle))
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
 15219
     && __isStringLike(aValueName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15220
	int ret;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15221
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15222
	myKey = (HKEY)__externalAddressVal(__INST(handle));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15223
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15224
	/*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15225
	 * try to get it with one call ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15226
	 */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15227
	ret = RegQueryValueEx(myKey, __stringVal(aValueName),
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15228
			 NULL,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15229
			 &valueType,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15230
			 (char *)&quickData,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15231
			 &dataSize);
10692
043cb2920c0a *** empty log message ***
sr
parents: 10690
diff changeset
 15232
#if 0
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15233
	console_printf("dataSize=%d\n", dataSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15234
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15235
	while (ret == ERROR_MORE_DATA) {
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15236
#if 0
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15237
	    console_printf("ERROR_MORE_DATA dataSize=%d\n", dataSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15238
	    console_printf("valueType=%d\n", valueType);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15239
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15240
	    /*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15241
	     * nope - need another one ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15242
	     */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15243
	    if (myKey = HKEY_PERFORMANCE_DATA) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15244
		dataSize = dataSize * 2;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15245
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15246
	    switch (valueType) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15247
		case REG_BINARY:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15248
		case REG_MULTI_SZ:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15249
		    dataBuffer = malloc(dataSize);;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15250
		    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15251
		case REG_SZ:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15252
		    dataBuffer = malloc(dataSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15253
		    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15254
		default:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15255
		    console_printf("RegistryEntry [warning]: unhandled valueType: %d\n", valueType);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15256
		    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15257
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15258
	    if (dataBuffer) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15259
		ret = RegQueryValueEx(myKey, __stringVal(aValueName),
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15260
				 NULL,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15261
				 &valueType,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15262
				 dataBuffer,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15263
				 &dataSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15264
	    } else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15265
		break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15266
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15267
	    if (myKey != HKEY_PERFORMANCE_DATA) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15268
		if (ret != ERROR_SUCCESS) break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15269
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15270
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15271
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15272
	if (ret == ERROR_SUCCESS) {
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15273
#if 0
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15274
	    console_printf("ERROR_SUCCESS dataSize=%d\n", dataSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15275
	    console_printf("valueType=%d\n", valueType);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15276
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15277
	    switch (valueType) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15278
		case REG_NONE:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15279
		    /* RETURN (@symbol(none));  */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15280
		    retVal = nil;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15281
		    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15282
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15283
		case REG_BINARY:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15284
		    retVal = __MKBYTEARRAY(dataBuffer ? dataBuffer : quickData.smallDataBuffer, dataSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15285
		    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15286
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15287
		case REG_SZ:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15288
		case REG_EXPAND_SZ:
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15289
#ifdef USE_UNICODE
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15290
		    retVal = __MKU16STRING(dataBuffer ? dataBuffer : quickData.smallDataBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15291
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15292
		    retVal = __MKSTRING(dataBuffer ? dataBuffer : quickData.smallDataBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15293
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15294
		    break;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15295
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15296
#if 0
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15297
		case REG_DWORD:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15298
		    /* int in native format */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15299
		    retVal = __MKUINT(quickData.dWord);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15300
		    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15301
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15302
		case REG_DWORD_LITTLE_ENDIAN:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15303
		    val = quickData.dWordBytes[3];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15304
		    val = (val << 8) | quickData.dWordBytes[2];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15305
		    val = (val << 8) | quickData.dWordBytes[1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15306
		    val = (val << 8) | quickData.dWordBytes[0];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15307
		    retVal = __MKUINT(val);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15308
		    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15309
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15310
		case REG_DWORD_BIG_ENDIAN:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15311
		    val = quickData.dWordBytes[0];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15312
		    val = (val << 8) | quickData.dWordBytes[1];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15313
		    val = (val << 8) | quickData.dWordBytes[2];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15314
		    val = (val << 8) | quickData.dWordBytes[3];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15315
		    retVal = __MKUINT(val);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15316
		    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15317
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15318
		case REG_MULTI_SZ:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15319
		    {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15320
			CHAR *cp, *cp0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15321
			int ns, i;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15322
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15323
			cp0 = dataBuffer ? dataBuffer : quickData.smallDataBuffer;
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15324
#if 0
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15325
			console_printf("**************\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15326
			for (i=0;i<50;i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15327
			  console_printf("%x ", cp0[i]);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15328
			}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15329
			console_printf("\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15330
			for (i=0;i<50;i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15331
			  if (cp0[i] == 0)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15332
			    console_printf("\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15333
			  else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15334
			    console_printf("%c", cp0[i]);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15335
			}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15336
			console_printf("\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15337
			console_printf("**************\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15338
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15339
			cp = cp0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15340
			ns = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15341
			while (*cp) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15342
			    while (*cp++) ;;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15343
			    ns++;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15344
			}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15345
			stringArray = __ARRAY_NEW_INT(ns);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15346
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15347
			i = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15348
			while (*cp0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15349
			    OBJ s;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15350
			    CHAR *cp;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15351
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15352
			    cp = cp0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15353
			    while (*cp++) ;;
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15354
#ifdef USE_UNICODE
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15355
			    s = __MKU16STRING(cp0); __ArrayInstPtr(stringArray)->a_element[i] = s; __STORE(stringArray, s);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15356
#else
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15357
			    s = __MKSTRING(cp0); __ArrayInstPtr(stringArray)->a_element[i] = s; __STORE(stringArray, s);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15358
#endif
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15359
			    cp0 = cp;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15360
			    i++;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15361
			}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15362
			retVal = stringArray;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15363
			break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15364
		    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15365
		default:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15366
		    console_printf("RegistryEntry [warning]: unhandled valueType: %d\n", valueType);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15367
		    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15368
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15369
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15370
	    if ((ret != ERROR_PATH_NOT_FOUND)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15371
	     && (ret != ERROR_FILE_NOT_FOUND)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15372
		errorNumber = __MKSMALLINT(ret);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15373
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15374
	}
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15375
    }
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15376
    if (dataBuffer) free(dataBuffer);
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15377
%}.
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15378
    errorNumber notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15379
	(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
 15380
    ].
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15381
10682
c5acf1548041 registry fixes;
sr
parents: 10664
diff changeset
 15382
    ^ retVal
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15383
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15384
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15385
     |key|
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
     key := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15388
     key valueNamed:'CurrentVersion'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15389
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15390
!
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
valueNamed:aValueName put:datum
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15393
    "store a value; the value type depends upon the stored value:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15394
	ByteArray       -> REG_BINARY
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15395
	String          -> REG_SZ
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15396
	Array of string -> REG_MULTI_SZ
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15397
	Integer         -> REG_DWORD
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15398
	nil             -> REG_NONE
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15399
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15400
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15401
    |data stringArray errorNumber|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15402
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15403
    HKEY myKey;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15404
    DWORD valueType = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15405
    int val;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15406
    DWORD dataSize = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15407
    unsigned char *dataPointer = NULL;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15408
    int datumOk = 1, mustFreeData = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15409
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 15410
    if (__isExternalAddressLike(__INST(handle))
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
 15411
     && __isStringLike(aValueName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15412
	int ret;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15413
	OBJ cls;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15414
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15415
	myKey = (HKEY)__externalAddressVal(__INST(handle));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15416
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15417
	if (datum == nil) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15418
	    valueType = REG_NONE;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15419
	    dataSize = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15420
	} else if (__isSmallInteger(datum)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15421
	    valueType = REG_DWORD;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15422
	    val = __intVal(datum);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15423
	    dataPointer = (unsigned char *)(&val);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15424
	    dataSize = sizeof(val);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15425
	} else if (__isStringLike(datum)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15426
	    valueType = REG_SZ;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15427
	    dataPointer = __stringVal(datum);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15428
	    dataSize = __stringSize(datum) + 1;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15429
	} else if (__Class(datum) == ByteArray) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15430
	    valueType = REG_BINARY;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15431
	    dataPointer = __ByteArrayInstPtr(datum)->ba_element;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15432
	    dataSize = __byteArraySize(datum);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15433
	} else if (__Class(datum) == LargeInteger) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15434
	    valueType = REG_DWORD;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15435
	    val = __longIntVal(datum);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15436
	    if (val) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15437
		dataPointer = (unsigned char *)(&val);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15438
		dataSize = sizeof(val);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15439
	    } else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15440
		datumOk = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15441
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15442
	} else if (__Class(datum) == Array) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15443
	    int i = 0, ns = 0, totalSize = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15444
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15445
	    valueType = REG_MULTI_SZ;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15446
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
	     * must allocate a local buffer
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15449
	     * find size ...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15450
	     */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15451
	    for (i=0; i<__arraySize(datum); i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15452
		OBJ s = __ArrayInstPtr(datum)->a_element[i];
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
		if (__isStringLike(s)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15455
		    totalSize += __stringSize(s) + 1;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15456
		} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15457
		    datumOk = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15458
		    break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15459
		}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15460
		ns++;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15461
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15462
	    if (datumOk) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15463
		char *cp;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15464
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15465
		/*
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15466
		 * allocate and fill...
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15467
		 */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15468
		totalSize ++;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15469
		dataPointer = (char *)(malloc(totalSize));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15470
		mustFreeData = 1;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15471
		cp = dataPointer;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15472
		for (i=0; i<__arraySize(datum); i++) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15473
		    OBJ s = __ArrayInstPtr(datum)->a_element[i];
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15474
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15475
		    strcpy(cp, __stringVal(s));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15476
		    cp += __stringSize(s);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15477
		    *cp++ = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15478
		}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15479
		*cp++ = '\0';
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15480
		dataSize = totalSize;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15481
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15482
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15483
	    datumOk = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15484
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15485
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15486
	if (datumOk) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15487
	    ret = RegSetValueExA(myKey, __stringVal(aValueName),
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15488
				0, valueType,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15489
				dataPointer, dataSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15490
	    if (mustFreeData) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15491
		free(dataPointer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15492
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15493
	    if (ret == ERROR_SUCCESS) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15494
		RETURN (true);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15495
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15496
	    if ((ret != ERROR_PATH_NOT_FOUND)
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15497
	     && (ret != ERROR_FILE_NOT_FOUND)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15498
		errorNumber = __MKSMALLINT(ret);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15499
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15500
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15501
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15502
%}.
10752
2d7d170b1f05 report errors as exceptions when accessing the registry without permission
Claus Gittinger <cg@exept.de>
parents: 10746
diff changeset
 15503
    errorNumber notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15504
	(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
 15505
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15506
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15507
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15508
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15509
     |key|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15510
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15511
     key := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15512
     key valueNamed:'CurrentVersion' put:'3.5.2'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15513
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15514
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15515
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15516
!Win32OperatingSystem::RegistryEntry methodsFor:'enumeration'!
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
allSubKeysDo:aBlock
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15519
    "recursively evaluate aBlock for all subKeys below the receiver"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15520
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15521
    |idx subEntry|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15522
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15523
    idx := 0.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15524
    [true] whileTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15525
	subEntry := self subKeyAtIndex:idx.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15526
	subEntry isNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15527
	    ^self
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15528
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15529
	aBlock value:subEntry.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15530
	subEntry allSubKeysDo:aBlock.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15531
	subEntry close.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15532
	idx := idx + 1.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15533
    ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15534
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15535
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15536
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15537
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15538
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15539
     top allSubKeysDo:[:subEntry |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15540
	Transcript showCR:subEntry path
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15541
     ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15542
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15543
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15544
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15545
subKeys
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15546
    "return a collection of subKeys below the receiver"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15547
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15548
    |idx subEntry subKeys|
5135
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 15549
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 15550
    subKeys := OrderedCollection new.
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 15551
    self subKeysDo:[:k | subKeys add:k].
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 15552
    ^ subKeys
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 15553
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 15554
    "
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 15555
     |top sub|
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 15556
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 15557
     top := self key:'HKEY_LOCAL_MACHINE'.
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 15558
     top subKeys
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 15559
    "
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 15560
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 15561
    "Created: / 23.12.1999 / 22:15:22 / cg"
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 15562
    "Modified: / 23.12.1999 / 22:15:44 / cg"
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 15563
!
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 15564
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15565
subKeysDo:aBlock
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15566
    "evaluate aBlock for all subKeys below the receiver"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15567
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15568
    |idx subEntry|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15569
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15570
    idx := 0.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15571
    [true] whileTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15572
	subEntry := self subKeyAtIndex:idx.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15573
	subEntry isNil ifTrue:[
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15574
	    ^self
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15575
	].
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15576
	aBlock value:subEntry.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15577
	subEntry close.
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15578
	idx := idx + 1.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15579
    ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15580
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15581
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15582
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15583
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15584
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15585
     top subKeysDo:[:subEntry |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15586
	Transcript showCR:subEntry path
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15587
     ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15588
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15589
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15590
13223
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 15591
valueNames
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 15592
    "evaluate aBlock for all value names"
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 15593
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 15594
    ^ Array streamContents:[:s |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15595
	self valueNamesDo:[:nm | s nextPut:nm]
13223
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 15596
    ].
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 15597
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 15598
    "Created: / 18-01-2011 / 20:24:52 / cg"
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 15599
!
Claus Gittinger <cg@exept.de>
parents: 13197
diff changeset
 15600
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15601
valueNamesAndValuesDo:aBlock
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15602
    "evaluate aBlock for all value names"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15603
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15604
    self valueNamesDo:[:nm |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15605
	aBlock value:nm value:(self valueNamed:nm)
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15606
    ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15607
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15608
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15609
     |key|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15610
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15611
     key := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15612
     key valueNamesAndValuesDo:[:nm :val |
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15613
	Transcript showCR:(nm , ' -> ' , val storeString).
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15614
     ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15615
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15616
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15617
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15618
valueNamesDo:aBlock
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15619
    "evaluate aBlock for all value names"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15620
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15621
    |idx valueName|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15622
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15623
    idx := 0.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15624
    [true] whileTrue:[
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15625
	valueName := self valueNameAtIndex:idx.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15626
	valueName isNil ifTrue:[
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15627
	    ^self
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15628
	].
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15629
	aBlock value:valueName.
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15630
	idx := idx + 1.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15631
    ]
9156
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
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15634
!Win32OperatingSystem::RegistryEntry methodsFor:'instance release'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15635
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15636
close
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15637
    "close mySelf"
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
    self closeKey.
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15640
    self unregisterForFinalization.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15641
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15642
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15643
closeKey
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15644
    "close mySelf"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15645
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
    HKEY myKey;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15648
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15649
    if (__isExternalAddressLike(__INST(handle))) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15650
	myKey = (HKEY)(__externalAddressVal(__INST(handle)));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15651
	__INST(handle) = nil;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15652
	RegCloseKey(myKey);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15653
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15654
%}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15655
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15656
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15657
finalizationLobby
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15658
    ^ Lobby
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15659
!
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
 15660
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15661
finalize
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15662
    "some entry has been collected - close it"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15663
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15664
    handle notNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15665
	self closeKey.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15666
    ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15667
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15668
    "Created: / 19.5.1999 / 22:39:52 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15669
    "Modified: / 19.5.1999 / 22:44:50 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15670
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15671
11135
db5762c9d81b #getDomainName - Domain is found in CurrentControlSet - no need
Stefan Vogel <sv@exept.de>
parents: 11129
diff changeset
 15672
!Win32OperatingSystem::RegistryEntry methodsFor:'printing & storing'!
db5762c9d81b #getDomainName - Domain is found in CurrentControlSet - no need
Stefan Vogel <sv@exept.de>
parents: 11129
diff changeset
 15673
db5762c9d81b #getDomainName - Domain is found in CurrentControlSet - no need
Stefan Vogel <sv@exept.de>
parents: 11129
diff changeset
 15674
printOn:aStream
11215
b4ffb4c6628d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11193
diff changeset
 15675
    aStream
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15676
	nextPutAll:self className;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15677
	nextPut:$(;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15678
	nextPutAll:path;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15679
	nextPut:$).
11135
db5762c9d81b #getDomainName - Domain is found in CurrentControlSet - no need
Stefan Vogel <sv@exept.de>
parents: 11129
diff changeset
 15680
! !
db5762c9d81b #getDomainName - Domain is found in CurrentControlSet - no need
Stefan Vogel <sv@exept.de>
parents: 11129
diff changeset
 15681
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15682
!Win32OperatingSystem::RegistryEntry methodsFor:'private'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15683
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15684
setHandle:aHandle path:aPathString
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15685
    handle := aHandle.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15686
    path := aPathString.
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
    "Created: / 19.5.1999 / 22:27:05 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15689
!
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
setupForHandleValue:integerHandleValue
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15692
    "not normally used - given an integer address,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15693
     return a registry entry. This is provided to
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15694
     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
 15695
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
    HKEY key;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15698
    OBJ t;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15699
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15700
    key = (HKEY)__longIntVal(integerHandleValue);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15701
    if (! key) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15702
	RETURN (nil);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15703
    }
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
    t = __MKEXTERNALADDRESS(key); __INST(handle) = t; __STORE(self, t);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15706
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15707
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15708
    "Created: / 19.5.1999 / 21:45:05 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15709
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15710
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15711
!Win32OperatingSystem::TextMetricsStructure class methodsFor:'instance creation'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15712
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15713
new
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15714
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15715
^super new: self sizeInBytes
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15716
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15717
    "Created: / 02-08-2006 / 16:20:02 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15718
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15719
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 15720
sizeInBytes
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15721
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15722
  ^53
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15723
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15724
    "Created: / 02-08-2006 / 16:20:09 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15725
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15726
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15727
!Win32OperatingSystem::TextMetricsStructure methodsFor:'accessing'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15728
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15729
tmDefaultChar
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15730
    ^self byteAt: 46 + 1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15731
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15732
    "Created: / 02-08-2006 / 16:15:35 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15733
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15734
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15735
tmExternalLeading
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15736
    ^self longAt: 16 + 1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15737
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15738
    "Created: / 02-08-2006 / 16:17:11 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15739
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15740
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15741
tmHeight
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15742
    ^self longAt: 0 + 1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15743
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15744
    "Created: / 02-08-2006 / 16:16:38 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15745
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 15746
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15747
!Win32OperatingSystem::Win32IOHandle class methodsFor:'documentation'!
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
documentation
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15750
"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15751
    I represent a handle on which I/O is possible.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15752
    Typical instances are File-Handles, Socket-Handles etc.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15753
"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15754
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 15755
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15756
!Win32OperatingSystem::Win32IOHandle methodsFor:'finalization'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15757
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15758
finalize
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15759
    "a handle was garbage collected - close the underlying file"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15760
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15761
    self closeFile
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15762
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15763
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15764
!Win32OperatingSystem::Win32IOHandle methodsFor:'io'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15765
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15766
readBytes:count into:aByteBuffer startingAt:firstIndex
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15767
    "read count bytes into a byte-buffer;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15768
     Return the number of bytes read (negative on error)"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15769
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15770
    |errSym errorNumber|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15771
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15772
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15773
    unsigned char *extPtr;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15774
    int bufferIsExternalBytes;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15775
    int mustFreeBuffer = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15776
    int nRead = -1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15777
    HANDLE hFile = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15778
    DWORD cntWanted, offs, cntRead;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15779
    int bufferSize;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15780
    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
 15781
    int ok;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15782
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15783
    if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15784
	errSym = @symbol(errorNotOpen);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15785
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15786
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15787
    if (! __bothSmallInteger(count, firstIndex)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15788
	errSym = @symbol(badArgument);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15789
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15790
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15791
    cntWanted = __smallIntegerVal(count);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15792
    if (cntWanted <= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15793
	errSym = @symbol(badCount);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15794
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15795
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15796
    offs = __smallIntegerVal(firstIndex) - 1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15797
    if (offs < 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15798
	errSym = @symbol(badOffset);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15799
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15800
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15801
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15802
    bufferIsExternalBytes = __isExternalBytesLike(aByteBuffer);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15803
    if (! bufferIsExternalBytes) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15804
	if (__isByteArray(aByteBuffer)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15805
	    bufferSize = __byteArraySize(aByteBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15806
	} else if (__isString(aByteBuffer)) {  // not isStringLike here !
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15807
	    bufferSize = __stringSize(aByteBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15808
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15809
	    errSym = @symbol(badBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15810
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15811
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15812
	if (bufferSize < (cntWanted + offs)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15813
	    errSym = @symbol(badBufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15814
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15815
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15816
	if (cntWanted <= sizeof(miniBuffer)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15817
	    extPtr = miniBuffer;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15818
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15819
	    extPtr = malloc(cntWanted);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15820
	    mustFreeBuffer = 1;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15821
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15822
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15823
	OBJ sz;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15824
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15825
	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
 15826
	if (extPtr == NULL) goto bad;
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15827
	sz = __externalBytesSize(aByteBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15828
	if (! __isSmallInteger(sz)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15829
	    errSym = @symbol(badBufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15830
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15831
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15832
	bufferSize = __smallIntegerVal(sz);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15833
	if (bufferSize < (cntWanted + offs)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15834
	    errSym = @symbol(badBufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15835
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15836
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15837
	extPtr = extPtr + offs;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15838
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15839
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15840
    do {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15841
	__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
 15842
	// do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15843
	ok = 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
 15844
    } while(__threadErrno == EINTR);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15845
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15846
    if (ok == TRUE) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15847
	if (! bufferIsExternalBytes) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15848
	    /* copy over */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15849
	    memcpy(__byteArrayVal(aByteBuffer)+offs, extPtr, cntRead);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15850
	    if (mustFreeBuffer) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15851
		free(extPtr);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15852
	    }
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15853
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15854
	RETURN (__mkSmallInteger(cntRead));
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15855
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15856
    errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15857
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15858
bad: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15859
    if (mustFreeBuffer) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15860
	free(extPtr);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15861
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15862
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15863
9154
d7f8a015da92 more com experiments
Claus Gittinger <cg@exept.de>
parents: 9153
diff changeset
 15864
    errorNumber isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15865
	self error:'invalid argument(s): ', errSym.
9155
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 15866
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15867
	(OperatingSystem errorHolderForNumber:errorNumber) reportError
9155
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 15868
    ].
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
 15869
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15870
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15871
     |h buff n|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15872
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15873
     h := self basicNew.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15874
     buff := ByteArray new:10.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15875
     n := h readBytes:10 into:buff startingAt:1.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15876
     Transcript show:n; show:' '; showCR:buff.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15877
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15878
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15879
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15880
readWaitWithTimeoutMs:millis
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15881
    "return true if a timeout occurred"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15882
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15883
    |errSym errorNumber|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15884
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15885
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15886
    HANDLE hFile = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15887
    DWORD res;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15888
    INT t;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15889
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15890
    if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15891
	errSym = @symbol(errorNotOpen);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15892
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15893
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15894
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15895
#if 0
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15896
    if (ioctlsocket((SOCKET)hFile, FIONREAD, &res)==0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15897
	/* its a socket */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15898
	if (res > 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15899
	    RETURN ( false );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15900
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15901
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15902
    if (PeekNamedPipe(hFile, 0, 0, 0, &res, 0)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15903
	/* its a namedPipe */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15904
	if (res > 0) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15905
	    RETURN ( false );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15906
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15907
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15908
#endif
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15909
    if (__isSmallInteger(millis)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15910
	t = __intVal(millis);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15911
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15912
	t = INFINITE;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15913
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15914
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15915
    do {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15916
	__threadErrno = 0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15917
	res = WaitForSingleObject(hFile, t);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15918
    } while (__threadErrno == EINTR);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15919
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15920
    switch (res) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15921
	case WAIT_OBJECT_0:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15922
	    /* signalled */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15923
	    RETURN ( false );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15924
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15925
	case WAIT_TIMEOUT:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15926
	    /* signalled */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15927
	    RETURN ( true );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15928
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15929
	default:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15930
	case WAIT_ABANDONED:
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15931
	    errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15932
	    goto bad;
9156
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
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15935
bad: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15936
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15937
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15938
     timeout argument not integer,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15939
     or any fd-array nonNil and not an array
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15940
     or not supported by OS
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
    ^ self primitiveFailed
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15943
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15944
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15945
seekTo:newPosition from:whence
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15946
    "whence is one of:
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15947
	#begin
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15948
	#current
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15949
	#end
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15950
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15951
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15952
    |errSym errorNumber|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15953
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15954
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15955
    HANDLE hFile = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15956
    DWORD moveHow;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15957
    LONG posLo, posHi = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15958
    __uint64__ pos64, newPos64;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15959
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15960
    if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15961
	errSym = @symbol(errorNotOpen);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15962
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15963
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15964
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15965
    if (whence == @symbol(begin)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15966
	moveHow = FILE_BEGIN;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15967
    } else if (whence == @symbol(current)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15968
	moveHow = FILE_CURRENT;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15969
    } else if (whence == @symbol(end)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15970
	moveHow = FILE_END;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15971
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15972
	errSym = @symbol(badArgument2);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15973
	goto bad;
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 15974
    }
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 15975
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 15976
    if (__signedLong64IntVal(newPosition, &pos64) == 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15977
	errSym = @symbol(badArgument);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15978
	goto bad;
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 15979
    }
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15980
#if __POINTER_SIZE__ == 8
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15981
    posLo = pos64 & 0xFFFFFFFF;
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15982
    posHi = (pos64 >> 32) & 0xFFFFFFFF;
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15983
#else
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 15984
    posLo = pos64.lo;
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 15985
    posHi = pos64.hi;
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 15986
#endif
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 15987
    posLo = SetFilePointer(hFile, posLo, &posHi, moveHow);
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 15988
    if (posLo == 0xFFFFFFFF) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15989
	int lastError;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15990
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15991
	/* can be either an error, or a valid low-word */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15992
	lastError = GetLastError();
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15993
	if (lastError != NO_ERROR) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15994
	    errorNumber = __mkSmallInteger( __WIN32_ERR(lastError) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15995
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 15996
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15997
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15998
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 15999
    if (posHi == 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16000
	RETURN (__MKUINT( posLo ));
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16001
    }
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16002
#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
 16003
    newPos64 = (__uint64__)posLo | ((__uint64__)posHi << 32);
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16004
    RETURN ( __MKUINT(newPos64) );
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16005
#else
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16006
    newPos64.lo = posLo;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16007
    newPos64.hi = posHi;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16008
    RETURN ( __MKUINT64(&newPos64) );
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14520
diff changeset
 16009
#endif
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16010
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16011
bad: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16012
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16013
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16014
    errorNumber isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16015
	self error:'invalid argument(s): ', errSym.
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16016
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16017
	(OperatingSystem errorHolderForNumber:errorNumber) reportError
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16018
    ].
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16019
!
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
 16020
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16021
writeBytes:count from:aByteBuffer startingAt:firstIndex
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16022
    "write count bytes from a byte-buffer;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16023
     Return the number of bytes written (negative on error)"
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
    |errSym errorNumber|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16026
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16027
    unsigned char *extPtr;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16028
    int bufferIsExternalBytes;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16029
    int mustFreeBuffer = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16030
    int nWritten = -1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16031
    HANDLE hFile = (HANDLE)(__externalAddressVal(self));
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 16032
    DWORD cntWanted, offs, cntWritten;
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 16033
    int bufferSize;
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16034
    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
 16035
    int ok;
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 16036
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 16037
    if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16038
	errSym = @symbol(errorNotOpen);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16039
	goto bad;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 16040
    }
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16041
    if (! __bothSmallInteger(count, firstIndex)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16042
	errSym = @symbol(badArgument);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16043
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16044
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16045
    cntWanted = __smallIntegerVal(count);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16046
    if (cntWanted <= 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16047
	errSym = @symbol(badCount);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16048
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16049
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16050
    offs = __smallIntegerVal(firstIndex) - 1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16051
    if (offs < 0) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16052
	errSym = @symbol(badOffset);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16053
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16054
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16055
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16056
    bufferIsExternalBytes = __isExternalBytesLike(aByteBuffer);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16057
    if (! bufferIsExternalBytes) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16058
	if (__isByteArray(aByteBuffer)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16059
	    bufferSize = __byteArraySize(aByteBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16060
	} else if (__isStringLike(aByteBuffer)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16061
	    bufferSize = __stringSize(aByteBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16062
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16063
	    errSym = @symbol(badBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16064
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16065
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16066
	if (bufferSize < (cntWanted + offs)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16067
	    errSym = @symbol(badBufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16068
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16069
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16070
	if (cntWanted <= sizeof(miniBuffer)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16071
	    extPtr = miniBuffer;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16072
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16073
	    extPtr = malloc(cntWanted);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16074
	    mustFreeBuffer = 1;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16075
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16076
	memcpy(extPtr, __byteArrayVal(aByteBuffer)+offs, cntWanted);
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 16077
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16078
	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
 16079
	if (extPtr == NULL) goto bad;
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16080
	bufferSize = __externalBytesSize(aByteBuffer);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16081
	if (! __isSmallInteger(bufferSize)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16082
	    errSym = @symbol(badBufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16083
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16084
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16085
	bufferSize = __smallIntegerVal(bufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16086
	if (bufferSize < (cntWanted + offs)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16087
	    errSym = @symbol(badBufferSize);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16088
	    goto bad;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16089
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16090
	extPtr = extPtr + offs;
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16091
    }
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16092
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16093
    do {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16094
	__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
 16095
	// do not cast to INT - will loose sign bit then!
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16096
	ok = 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
 16097
    } while(__threadErrno == EINTR);
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16098
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16099
    if (ok == TRUE) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16100
	if (mustFreeBuffer) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16101
	    free(extPtr);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16102
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16103
	RETURN (__mkSmallInteger(cntWritten));
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16104
    }
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16105
    errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16106
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 16107
bad: ;
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16108
    if (mustFreeBuffer) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16109
	free(extPtr);
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 16110
    }
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 16111
%}.
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 16112
    errorNumber isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16113
	self error:'invalid argument(s): ', errSym.
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 16114
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16115
	(OperatingSystem errorHolderForNumber:errorNumber) reportError
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 16116
    ].
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 16117
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 16118
    "
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 16119
     |h buff n|
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 16120
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 16121
     h := self basicNew.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 16122
     h setFileDescriptor:1.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 16123
     buff := '12345678901234567890'.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 16124
     n := h writeBytes:10 from:buff startingAt:1.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 16125
    "
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16126
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16127
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16128
!Win32OperatingSystem::Win32IOHandle methodsFor:'release'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16129
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16130
close
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16131
    "close the file"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16132
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16133
    self closeFile.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16134
    self unregisterForFinalization.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16135
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16136
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16137
closeFile
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16138
    "close the handle"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16139
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16140
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16141
    HANDLE h = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16142
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16143
    if (h) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16144
	__externalAddressVal(self) = (HANDLE)0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16145
	CloseHandle(h);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16146
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16147
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16148
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16149
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16150
!Win32OperatingSystem::Win32NetworkResourceHandle class methodsFor:'accessing - types'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16151
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16152
displayTypeMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16153
    "answer a Dictionary containing displayTypes symbols to integer mapping and vice versa"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16154
    | symbTable |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16155
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16156
    DisplayTypeMappingTable notNil ifTrue:[ ^ DisplayTypeMappingTable ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16157
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16158
    symbTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16159
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16160
    __AT_PUT_(symbTable , @symbol(GENERIC),      __MKUINT( RESOURCEDISPLAYTYPE_GENERIC ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16161
    __AT_PUT_(symbTable , @symbol(DOMAIN),       __MKUINT( RESOURCEDISPLAYTYPE_DOMAIN ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16162
    __AT_PUT_(symbTable , @symbol(SERVER),       __MKUINT( RESOURCEDISPLAYTYPE_SERVER ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16163
    __AT_PUT_(symbTable , @symbol(SHARE),        __MKUINT( RESOURCEDISPLAYTYPE_SHARE ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16164
    __AT_PUT_(symbTable , @symbol(FILE),         __MKUINT( RESOURCEDISPLAYTYPE_FILE ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16165
    __AT_PUT_(symbTable , @symbol(GROUP),        __MKUINT( RESOURCEDISPLAYTYPE_GROUP ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16166
    __AT_PUT_(symbTable , @symbol(NETWORK),      __MKUINT( RESOURCEDISPLAYTYPE_NETWORK ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16167
    __AT_PUT_(symbTable , @symbol(ROOT),         __MKUINT( RESOURCEDISPLAYTYPE_ROOT ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16168
    __AT_PUT_(symbTable , @symbol(SHAREADMIN),   __MKUINT( RESOURCEDISPLAYTYPE_SHAREADMIN ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16169
    __AT_PUT_(symbTable , @symbol(DIRECTORY),    __MKUINT( RESOURCEDISPLAYTYPE_DIRECTORY ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16170
    __AT_PUT_(symbTable , @symbol(TREE),         __MKUINT( RESOURCEDISPLAYTYPE_TREE ) );
15580
4f1aa9df6162 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15547
diff changeset
 16171
#ifdef RESOURCEDISPLAYTYPE_NDSCONTAINER
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16172
    __AT_PUT_(symbTable , @symbol(NDSCONTAINER), __MKUINT( RESOURCEDISPLAYTYPE_NDSCONTAINER ) );
15580
4f1aa9df6162 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15547
diff changeset
 16173
#endif
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16174
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16175
    DisplayTypeMappingTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16176
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16177
    symbTable keysAndValuesDo:[:aSYMB :anINT |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16178
	DisplayTypeMappingTable at: aSYMB put: anINT.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16179
	DisplayTypeMappingTable at: anINT put: aSYMB. "/ vice versa
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16180
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16181
    ^ DisplayTypeMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16182
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16183
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16184
scopeMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16185
    "answer a Dictionary with scopes mapping symbol to integer and vice verca"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16186
    | symbTable |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16187
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16188
    ScopeMappingTable notNil ifTrue:[ ^ ScopeMappingTable].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16189
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16190
    symbTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16191
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16192
    __AT_PUT_(symbTable, @symbol(CONNECTED),  __MKUINT( RESOURCE_CONNECTED ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16193
    __AT_PUT_(symbTable, @symbol(CONTEXT),    __MKUINT( RESOURCE_CONTEXT ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16194
    __AT_PUT_(symbTable, @symbol(GLOBALNET),  __MKUINT( RESOURCE_GLOBALNET ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16195
    __AT_PUT_(symbTable, @symbol(REMEMBERED), __MKUINT( RESOURCE_REMEMBERED ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16196
    __AT_PUT_(symbTable, @symbol(RECENT),     __MKUINT( RESOURCE_RECENT ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16197
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16198
    ScopeMappingTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16199
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16200
    symbTable keysAndValuesDo:[:aSYMB :anINT |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16201
	ScopeMappingTable at: aSYMB put: anINT.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16202
	ScopeMappingTable at: anINT put: aSYMB. "/ vice versa
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16203
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16204
    ^ ScopeMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16205
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16206
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16207
typeMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16208
    "answer a Dictionary containing types symbols to integer mapping and vice versa"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16209
    | symbTable |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16210
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16211
    TypeMappingTable notNil ifTrue:[ ^ TypeMappingTable].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16212
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16213
    symbTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16214
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16215
    __AT_PUT_(symbTable , @symbol(ANY),      __MKUINT( RESOURCETYPE_ANY ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16216
    __AT_PUT_(symbTable , @symbol(DISK),     __MKUINT( RESOURCETYPE_DISK ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16217
    __AT_PUT_(symbTable , @symbol(PRINT),    __MKUINT( RESOURCETYPE_PRINT ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16218
    __AT_PUT_(symbTable , @symbol(UNKNOWN),  __MKUINT( RESOURCETYPE_UNKNOWN ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16219
    __AT_PUT_(symbTable , @symbol(RESERVED), __MKUINT( RESOURCETYPE_RESERVED ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16220
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16221
    TypeMappingTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16222
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16223
    symbTable keysAndValuesDo:[:aSYMB :anINT |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16224
	TypeMappingTable at: aSYMB put: anINT.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16225
	TypeMappingTable at: anINT put: aSYMB. "/ vice versa
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16226
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16227
    ^ TypeMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16228
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16229
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16230
usageMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16231
    "answer a Dictionary containing usages symbols to integer mapping and vice versa"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16232
    | symbTable |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16233
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16234
    UsageMappingTable notNil ifTrue:[ ^ UsageMappingTable].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16235
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16236
    symbTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16237
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16238
    __AT_PUT_(symbTable , @symbol(NULL),          __MKUINT( 0 ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16239
    __AT_PUT_(symbTable , @symbol(CONNECTABLE),   __MKUINT( RESOURCEUSAGE_CONNECTABLE ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16240
    __AT_PUT_(symbTable , @symbol(CONTAINER),     __MKUINT( RESOURCEUSAGE_CONTAINER ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16241
    __AT_PUT_(symbTable , @symbol(ATTACHED),      __MKUINT( RESOURCEUSAGE_ATTACHED ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16242
    __AT_PUT_(symbTable , @symbol(ALL),           __MKUINT( RESOURCEUSAGE_ALL ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16243
    __AT_PUT_(symbTable , @symbol(NOLOCALDEVICE), __MKUINT( RESOURCEUSAGE_NOLOCALDEVICE ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16244
    __AT_PUT_(symbTable , @symbol(SIBLING),       __MKUINT( RESOURCEUSAGE_SIBLING ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16245
    __AT_PUT_(symbTable , @symbol(RESERVED),      __MKUINT( RESOURCEUSAGE_RESERVED ) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16246
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16247
    UsageMappingTable := Dictionary new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16248
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16249
    symbTable keysAndValuesDo:[:aSYMB :anINT |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16250
	UsageMappingTable at: aSYMB put: anINT.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16251
	UsageMappingTable at: anINT put: aSYMB. "/ vice versa
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16252
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16253
    ^ UsageMappingTable
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16254
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16255
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16256
!Win32OperatingSystem::Win32NetworkResourceHandle class methodsFor:'fetch resources'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16257
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16258
fetchResourcesStartingAt: aNetworkResourceOrNil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16259
    withScope: aScope type: aType usage: aUsage onError: aBlock
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16260
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16261
    "Fetch all resources from the given network resource or if nil the root system.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16262
     On success a collection of al network resources is returned.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16263
     If the open fails, the error block if notNil will be evaluated with the error number
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16264
     and nil is returned.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16265
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16266
    self fetchResourcesStartingAt: nil withScope: #GLOBALNET type: #ANY usage: 0
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 16267
	onError: [:err| Transcript showCR: err ].
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16268
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16269
    | stream networkResources |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16270
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16271
    [
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 16272
	stream := self openAt: aNetworkResourceOrNil
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 16273
	    withScope: aScope type: aType usage: aUsage onError: aBlock.
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 16274
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 16275
	stream notNil ifTrue:[
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 16276
	    |next|
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 16277
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 16278
	    networkResources := OrderedCollection new.
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 16279
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 16280
	    [ (next := stream nextOrNil) notNil ] whileTrue:[
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 16281
		networkResources add:next.
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 16282
	    ].
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 16283
	]
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16284
    ] ensure:[
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 16285
	stream notNil ifTrue:[ stream close ].
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16286
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16287
    ^ networkResources.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16288
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16289
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16290
fetchSystemResourcesWithScope: aScope type: aType usage: aUsage onError: aBlock
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16291
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16292
    "Fetch all system resources.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16293
     On success a collection of al network resources is returned.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16294
     If the open fails, the error block if notNil will be evaluated with the error number
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16295
     and nil is returned.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16296
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16297
    self fetchSystemResourcesWithScope: #GLOBALNET type: #ANY usage: 0
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 16298
	onError: [:err| Transcript showCR: err ].
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16299
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16300
    self fetchSystemResourcesWithScope: #REMEMBERED type: #DISK usage: 0
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 16301
	onError: [:err| Transcript showCR: err ].
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16302
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16303
    self fetchSystemResourcesWithScope: #REMEMBERED type: #ANY usage: 0
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 16304
	onError: [:err| Transcript showCR: err ].
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16305
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16306
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16307
    ^ self fetchResourcesStartingAt: nil
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 16308
	    withScope: aScope type: aType usage: aUsage onError: aBlock
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16309
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16310
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16311
fetchVirtualDrives
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16312
    "answer a collection of virtual drive resources
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16313
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16314
     self fetchVirtualDrives
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16315
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16316
    ^ self fetchSystemResourcesWithScope: #REMEMBERED type: #DISK usage: 0 onError: nil.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16317
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16318
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16319
!Win32OperatingSystem::Win32NetworkResourceHandle class methodsFor:'opening'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16320
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16321
openAt: aResourceOrNil withScope: aScope type: aType usage: aUsage onError: aBlock
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16322
    "Open a handle for network resource enumeratation starting at the given NetworkResource
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16323
     or if nil on the system root. On success the handle will is returned.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16324
     If the open fails, the error block if notNil will be evaluated with the error number
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16325
     and nil is returned.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16326
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16327
    OperatingSystem networkResourceAccessor openOn:nil withScope:#GLOBALNET  type:#ANY  usage:0 onError:nil.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16328
    OperatingSystem networkResourceAccessor openOn:nil withScope:#REMEMBERED type:#DISK usage:0 onError:nil.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16329
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16330
    | resourceHandle errorNumber enumScope enumUsage enumType
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16331
      resScope resType resUsage resDisplayType resComment resLocalName resRemoteName resProvider |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16332
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16333
    "/ map symbols to integer values.. on error an exception is raised
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16334
    aScope isInteger ifTrue:[ enumScope := aScope ]
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16335
		    ifFalse:[ enumScope := self scopeMappingTable at:aScope ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16336
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16337
    aUsage isInteger ifTrue:[ enumUsage := aUsage ]
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16338
		    ifFalse:[ enumUsage := self usageMappingTable at:aUsage ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16339
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16340
    aType isInteger ifTrue:[ enumType := aType ]
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16341
		   ifFalse:[ enumType := self typeMappingTable at:aType ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16342
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16343
    aResourceOrNil notNil ifTrue:[ | checkAndGetString |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16344
	resScope := aResourceOrNil scope.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16345
	resScope isInteger ifFalse:[ resScope := self scopeMappingTable at:resScope ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16346
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16347
	resType := aResourceOrNil type.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16348
	resType isInteger ifFalse:[ resType := self typeMappingTable at: resType ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16349
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16350
	resUsage := aResourceOrNil usage.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16351
	resUsage isInteger ifFalse:[ resUsage := self usageMappingTable at: resUsage ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16352
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16353
	resDisplayType := aResourceOrNil displayType.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16354
	resDisplayType isInteger ifFalse:[ resDisplayType := self displayTypeMappingTable at:resDisplayType ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16355
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16356
	checkAndGetString := [: aString| |string|
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16357
	    aString notNil ifTrue:[
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16358
		self isUsingUnicode
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16359
		    ifTrue: [ string := aString asUnicode16String  ]
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16360
		    ifFalse:[ string := aString asSingleByteString ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16361
	    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16362
	    string
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16363
	].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16364
	resRemoteName  := checkAndGetString value:( aResourceOrNil remoteName ).
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16365
	resLocalName   := checkAndGetString value:( aResourceOrNil localName ).
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16366
	resComment     := checkAndGetString value:( aResourceOrNil comment ).
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16367
	resProvider    := checkAndGetString value:( aResourceOrNil provider ).
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16368
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16369
    resourceHandle := self new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16370
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16371
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16372
    HANDLE __hEnum;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16373
    int    __errno;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16374
    DWORD  __scope = __unsignedLongIntVal( enumScope );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16375
    DWORD  __usage = __unsignedLongIntVal( enumUsage );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16376
    DWORD  __type  = __unsignedLongIntVal( enumType );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16377
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16378
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16379
    char           __buffer[ 8192 ];
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16380
    LPNETRESOURCE  __lpnetRes = (LPNETRESOURCE) __buffer;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16381
    char *         __cp = __buffer + sizeof(NETRESOURCE);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16382
    char *         __sp;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16383
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16384
    wchar_t        __buffer[ 8192 ];
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16385
    LPNETRESOURCEW __lpnetRes = (LPNETRESOURCEW) __buffer;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16386
    wchar_t *      __cp = __buffer + sizeof(NETRESOURCEW);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16387
    wchar_t *      __sp;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16388
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16389
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16390
    if( resScope == nil ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16391
	__lpnetRes = 0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16392
    } else {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16393
	int __sz;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16394
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16395
	ZeroMemory( __buffer, (__cp - __buffer) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16396
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16397
	__lpnetRes->dwScope       = __unsignedLongIntVal( resScope );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16398
	__lpnetRes->dwType        = __unsignedLongIntVal( resType  );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16399
	__lpnetRes->dwUsage       = __unsignedLongIntVal( resUsage );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16400
	__lpnetRes->dwDisplayType = __unsignedLongIntVal( resDisplayType );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16401
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16402
	if( resRemoteName != nil ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16403
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16404
	    __sp = __stringVal(resRemoteName);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16405
	    __sz = strlen(__sp);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16406
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16407
	    __sp = __unicode16StringVal(resRemoteName);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16408
	    __sz = __unicode16StringSize(resRemoteName);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16409
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16410
	    for( __lpnetRes->lpRemoteName = __cp; __sz > 0; --__sz ) { * __cp++ = * __sp++; }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16411
	    *__cp++ = 0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16412
	}
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16413
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16414
	if( resLocalName != nil ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16415
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16416
	    __sp = __stringVal(resLocalName);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16417
	    __sz = strlen(__sp);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16418
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16419
	    __sp = __unicode16StringVal(resLocalName);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16420
	    __sz = __unicode16StringSize(resLocalName);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16421
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16422
	    for( __lpnetRes->lpLocalName = __cp; __sz > 0; --__sz ) { * __cp++ = * __sp++; }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16423
	    *__cp++ = 0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16424
	}
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16425
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16426
	if( resComment != nil ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16427
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16428
	    __sp = __stringVal(resComment);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16429
	    __sz = strlen(__sp);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16430
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16431
	    __sp = __unicode16StringVal(resComment);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16432
	    __sz = __unicode16StringSize(resComment);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16433
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16434
	    for( __lpnetRes->lpComment = __cp; __sz > 0; --__sz ) { * __cp++ = * __sp++; }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16435
	    *__cp++ = 0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16436
	}
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16437
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16438
	if( resProvider != nil ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16439
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16440
	    __sp = __stringVal(resProvider);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16441
	    __sz = strlen(__sp);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16442
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16443
	    __sp = __unicode16StringVal(resProvider);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16444
	    __sz = __unicode16StringSize(resProvider);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16445
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16446
	    for( __lpnetRes->lpProvider = __cp; __sz > 0; --__sz ) { * __cp++ = * __sp++; }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16447
	    *__cp++ = 0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16448
	}
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16449
    }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16450
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16451
#ifdef DO_WRAP_CALLS
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16452
    do {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16453
	__threadErrno = 0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16454
#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
 16455
	// do not cast to INT - will loose sign bit then!
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 16456
	__errno = STX_API_NOINT_CALL5( "WNetOpenEnumA",  WNetOpenEnumA,  __scope, __type, __usage, __lpnetRes, & __hEnum );
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16457
#else
15543
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 16458
	// do not cast to INT - will loose sign bit then!
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16459
	__errno = STX_API_NOINT_CALL5( "WNetOpenEnumW", WNetOpenEnumW, __scope, __type, __usage, __lpnetRes, & __hEnum );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16460
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16461
    } while ((__errno < 0) && (__threadErrno == EINTR));
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16462
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16463
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16464
#ifdef USE_ANSI_NETWORKRESOURCES
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 16465
    __errno = WNetOpenEnumA ( __scope, __type, __usage, __lpnetRes, & __hEnum );
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16466
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16467
    __errno = WNetOpenEnumW( __scope, __type, __usage, __lpnetRes, & __hEnum );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16468
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16469
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16470
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16471
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16472
    if( __errno == NO_ERROR ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16473
	__externalAddressVal(resourceHandle) = (void *) __hEnum;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16474
    } else {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16475
	resourceHandle = nil;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16476
	errorNumber    = __mkSmallInteger( __errno );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16477
    }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16478
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16479
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16480
    resourceHandle isNil ifTrue:[
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16481
	aBlock notNil ifTrue:[ aBlock value: errorNumber ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16482
	^ nil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16483
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16484
    resourceHandle registerForFinalization.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16485
    ^ resourceHandle
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16486
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16487
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16488
!Win32OperatingSystem::Win32NetworkResourceHandle class methodsFor:'testing'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16489
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16490
isUsingUnicode
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16491
    "answer true if we are using unicode; has effect to the open and next operation"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16492
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16493
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16494
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16495
    RETURN( false );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16496
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16497
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16498
    ^ true
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16499
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16500
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16501
!Win32OperatingSystem::Win32NetworkResourceHandle methodsFor:'queries'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16502
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16503
atEnd
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16504
    "answer true if the stream is at the end (no longer valid)"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16505
    ^ (self address == 0)
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16506
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16507
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16508
!Win32OperatingSystem::Win32NetworkResourceHandle methodsFor:'reading'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16509
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16510
nextOrNil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16511
    "answer the next NetworkResource or nil (no more resource available);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16512
     if no more resource is available the stream is closed"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16513
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16514
    | scope type usage displayType comment localName remoteName provider |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16515
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16516
    self atEnd ifTrue:[ ^ nil ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16517
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16518
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16519
    HANDLE __hEnum = (HANDLE)(__externalAddressVal(self));
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16520
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16521
    if ((__hEnum == 0) || (__hEnum == INVALID_HANDLE_VALUE)) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16522
	__externalAddressVal(self) = (HANDLE)0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16523
    } else {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16524
	DWORD           __entries = 1;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16525
	DWORD           __bufSize = 8192;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16526
	int             __errno;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16527
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16528
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16529
	char            __buffer[ 8192 ];
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16530
	LPNETRESOURCE   __lpNetRes  = (LPNETRESOURCE)  __buffer;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16531
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16532
	ZeroMemory( __buffer, sizeof(NETRESOURCE) );
15177
8cb1904f7966 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 15169
diff changeset
 16533
	__errno = WNetEnumResourceA ( __hEnum , & __entries , __lpNetRes, & __bufSize );
15076
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16534
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16535
	wchar_t         __buffer[ 8192 ];
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16536
	LPNETRESOURCEW  __lpNetRes  = (LPNETRESOURCEW) __buffer;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16537
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16538
	ZeroMemory( __buffer, sizeof(NETRESOURCEW) );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16539
	__errno = WNetEnumResourceW ( __hEnum , & __entries , __lpNetRes, & __bufSize );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16540
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16541
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16542
	if( (__errno  == NO_ERROR) && (__entries == 1) ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16543
	    scope       = __MKUINT( __lpNetRes->dwScope );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16544
	    type        = __MKUINT( __lpNetRes->dwType );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16545
	    usage       = __MKUINT( __lpNetRes->dwUsage );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16546
	    displayType = __MKUINT( __lpNetRes->dwDisplayType );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16547
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16548
#ifdef USE_ANSI_NETWORKRESOURCES
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16549
	    if( __lpNetRes->lpRemoteName != 0 ) { remoteName =  __MKSTRING( __lpNetRes->lpRemoteName ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16550
	    if( __lpNetRes->lpLocalName  != 0 ) { localName  =  __MKSTRING( __lpNetRes->lpLocalName ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16551
	    if( __lpNetRes->lpComment    != 0 ) { comment    =  __MKSTRING( __lpNetRes->lpComment ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16552
	    if( __lpNetRes->lpProvider   != 0 ) { provider   =  __MKSTRING( __lpNetRes->lpProvider ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16553
#else
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16554
	    if( __lpNetRes->lpRemoteName != 0 ) { remoteName =  __MKU16STRING( __lpNetRes->lpRemoteName ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16555
	    if( __lpNetRes->lpLocalName  != 0 ) { localName  =  __MKU16STRING( __lpNetRes->lpLocalName ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16556
	    if( __lpNetRes->lpComment    != 0 ) { comment    =  __MKU16STRING( __lpNetRes->lpComment ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16557
	    if( __lpNetRes->lpProvider   != 0 ) { provider   =  __MKU16STRING( __lpNetRes->lpProvider ); }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16558
#endif
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16559
	}
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16560
    }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16561
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16562
    scope notNil ifTrue:[ |netResource|
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16563
	netResource := NetworkResource new.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16564
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16565
	"map integer values to symbol excluding the usage..."
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16566
	netResource scope: (self class scopeMappingTable at:scope ifAbsent:[scope]).
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16567
	netResource type:  (self class typeMappingTable  at:type ifAbsent:[type]).
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16568
	netResource displayType: (self class displayTypeMappingTable at:displayType ifAbsent:[displayType]).
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16569
	netResource usage: usage.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16570
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16571
	netResource remoteName: remoteName.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16572
	netResource localName: localName.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16573
	netResource comment: comment.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16574
	netResource provider: provider.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16575
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16576
	^ netResource
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16577
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16578
    self close.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16579
    ^ nil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16580
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16581
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16582
!Win32OperatingSystem::Win32NetworkResourceHandle methodsFor:'release'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16583
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16584
closeHandle
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16585
    "close the handle"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16586
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16587
    self address == 0 ifTrue:[ ^ self ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16588
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16589
    HANDLE __hEnum = (HANDLE)(__externalAddressVal(self));
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16590
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16591
    if (__hEnum) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16592
	__externalAddressVal(self) = (HANDLE)0;
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16593
	WNetCloseEnum(__hEnum);
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16594
    }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16595
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16596
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16597
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16598
!Win32OperatingSystem::Win32NetworkResourceHandle::NetworkResource methodsFor:'accessing'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16599
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16600
comment
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16601
    "comment supplied by the network provider or nil"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16602
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16603
    ^ comment
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16604
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16605
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16606
comment: aStringOrNil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16607
    "comment supplied by the network provider or nil"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16608
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16609
    comment := aStringOrNil.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16610
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16611
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16612
displayType
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16613
    "The display options for the network object in a network browsing user interface"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16614
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16615
    ^ displayType
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16616
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16617
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16618
displayType: theDisplayType
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16619
    "The display options for the network object in a network browsing user interface"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16620
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16621
    displayType := theDisplayType.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16622
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16623
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16624
localName
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16625
    "if the scope member is equal to RESOURCE_CONNECTED or RESOURCE_REMEMBERED,
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16626
     this specifies the name of a local device. This member is NULL if the connection
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16627
     does not use a device."
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16628
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16629
    ^ localName
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16630
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16631
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16632
localName: aStringOrNil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16633
    "if the scope member is equal to RESOURCE_CONNECTED or RESOURCE_REMEMBERED,
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16634
     this specifies the name of a local device. This member is NULL if the connection
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16635
     does not use a device."
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16636
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16637
    localName := aStringOrNil.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16638
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16639
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16640
provider
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16641
    "the name of the provider that owns the resource or nil"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16642
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16643
    ^ provider
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16644
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16645
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16646
provider: aStringOrNil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16647
    "the name of the provider that owns the resource or nil"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16648
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16649
    provider := aStringOrNil.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16650
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16651
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16652
remoteName
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16653
    "If the resource is a network resource, this specifies the remote network name.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16654
     If the resource is a current or persistent connection, this specifies the network
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16655
     name associated with the name pointed to by the localName"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16656
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16657
    ^ remoteName
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16658
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16659
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16660
remoteName: aStringOrNil
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16661
    "If the resource is a network resource, this specifies the remote network name.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16662
     If the resource is a current or persistent connection, this specifies the network
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16663
     name associated with the name pointed to by the localName"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16664
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16665
    remoteName := aStringOrNil.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16666
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16667
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16668
scope
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16669
    "The scope of the enumeration
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16670
	RESOURCE_CONNECTED RESOURCE_GLOBALNET RESOURCE_REMEMBERED
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16671
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16672
    ^ scope
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16673
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16674
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16675
scope: theScope
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16676
    "The scope of the enumeration
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16677
	RESOURCE_CONNECTED RESOURCE_GLOBALNET RESOURCE_REMEMBERED
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16678
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16679
    scope := theScope.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16680
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16681
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16682
type
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16683
    "describes the type of the resource
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16684
	RESOURCETYPE_ANY  RESOURCETYPE_DISK  RESOURCETYPE_PRINT
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16685
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16686
    ^ type
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16687
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16688
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16689
type: theType
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16690
    "describes the type of the resource
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16691
	RESOURCETYPE_ANY  RESOURCETYPE_DISK  RESOURCETYPE_PRINT
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16692
    "
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16693
    type := theType.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16694
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16695
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16696
usage
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16697
    "a set of bit flags (INTEGER) describing how the resource can be used"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16698
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16699
    ^ usage
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16700
!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16701
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16702
usage: anInteger
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16703
    "a set of bit flags (INTEGER) describing how the resource can be used"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16704
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16705
    usage := anInteger.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16706
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16707
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16708
!Win32OperatingSystem::Win32NetworkResourceHandle::NetworkResource methodsFor:'printing'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16709
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16710
printOn: aStream
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16711
    "print self on a stream"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16712
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16713
    | paction |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16714
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16715
    paction := [: anIdentifier :theValue |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16716
	anIdentifier printOn: aStream.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16717
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16718
	theValue notNil ifTrue:[
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16719
	    theValue isInteger ifTrue:[
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16720
		theValue printOn:aStream base:2 showRadix:true.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16721
	    ] ifFalse:[
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16722
		theValue isSymbol ifTrue:[
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16723
		    theValue printOn: aStream.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16724
		] ifFalse:[
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16725
		    aStream nextPut: $". theValue printOn: aStream. aStream nextPut: $"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16726
		]
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16727
	    ]
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16728
	].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16729
	aStream cr.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16730
    ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16731
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16732
    aStream nextPutAll: 'NetworkResource {'; cr.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16733
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16734
    paction value: '  Scope:        ' value:scope.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16735
    paction value: '  Type:         ' value:type.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16736
    paction value: '  DisplayType:  ' value:displayType.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16737
    paction value: '  Usage(mask):  ' value:usage.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16738
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16739
    aStream cr.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16740
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16741
    paction value: '  RemoteName:   ' value:remoteName.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16742
    paction value: '  LocalName:    ' value:localName.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16743
    paction value: '  Comment       ' value:comment.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16744
    paction value: '  Provider      ' value:provider.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16745
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16746
    aStream nextPut: $}; cr.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16747
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16748
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16749
!Win32OperatingSystem::Win32NetworkResourceHandle::NetworkResource methodsFor:'queries'!
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16750
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16751
isResourceContainer
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16752
    "answer true if the resource is a resource container"
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16753
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16754
    | flag |
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16755
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16756
    usage isInteger ifFalse:[ ^ usage = #CONTAINER ].
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16757
    flag := usage.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16758
%{
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16759
    DWORD __usage = __unsignedLongIntVal( flag );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16760
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16761
    if( __usage & RESOURCEUSAGE_CONTAINER ) {
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16762
	RETURN( true );
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16763
    }
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16764
%}.
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16765
    ^ false
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16766
! !
f4c814ed8258 Network Resources
ca
parents: 15039
diff changeset
 16767
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16768
!Win32OperatingSystem::Win32PrinterHandle methodsFor:'release'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16769
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16770
closeHandle
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16771
    self address ~~ 0 ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16772
	OperatingSystem primClosePrinter:self.
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16773
    ]
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16774
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16775
    "Created: / 27-07-2006 / 14:48:37 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16776
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 16777
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16778
!Win32OperatingSystem::Win32ProcessHandle methodsFor:'accessing'!
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
pid
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16781
    ^ pid
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16782
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16783
12632
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 16784
!Win32OperatingSystem::Win32ProcessHandle methodsFor:'printing & storing'!
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 16785
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 16786
printOn:aStream
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 16787
    "return a printed representation of the receiver"
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 16788
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 16789
    super printOn:aStream.
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 16790
    aStream nextPutAll:' pid:'.
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 16791
    pid printOn:aStream.
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 16792
! !
19e07026403f comment/format in:
Stefan Vogel <sv@exept.de>
parents: 12625
diff changeset
 16793
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16794
!Win32OperatingSystem::Win32SerialPortHandle methodsFor:'opening'!
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
open:portName baudRate:baudRate stopBitsType:stopBitsType
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16797
		    parityType:parityType dataBits:dataBits
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16798
		    inFlowCtrl:inFlowCtrlType outFlowCtrl:outFlowCtrlType
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16799
		    xOnChar:xOnChar xOffChar:xOffChar
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16800
    "portName: COM%d
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16801
     baudRate: Integer
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16802
     stopBitsType: #stop1, #stop2 or #stop1_5
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16803
     parityType: #odd, #even or #none
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16804
     dataBits: #integer
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16805
     inFlowCtrlType: #xOnOff #hardware
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16806
     outFlowCtrlType: #xOnOff #hardware
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16807
     xOnChar: Character or Integer
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16808
     xOffChar: Character or Integer"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16809
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16810
    |errorNumber|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16811
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16812
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16813
    HANDLE port;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16814
    COMMTIMEOUTS timeouts;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16815
    DCB dcb;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16816
    char *__portName;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16817
    int __setBaudRate = 1,
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16818
	__setDataBits = 1,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16819
	__setXOnChar = 1,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16820
	__setXOffChar = 1,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16821
	__setInFlowCtrl = 1,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16822
	__setOutFlowCtrl = 1,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16823
	__setStopBits = 1,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16824
	__setParityType = 1;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16825
    int __baudRate, __dataBits;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16826
    int __xOnChar, __xOffChar;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16827
    int __inFlowCtrl, __outFlowCtrl;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16828
    int __stopBits, __parityType;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16829
#   define XONOFF       1
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16830
#   define HARDWARE     2
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16831
#   define STOP1     1
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16832
#   define STOP2     2
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16833
#   define STOP1_5   3
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16834
#   define ODD       1
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16835
#   define EVEN      2
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16836
#   define NONE      3
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16837
12489
1bcb80d11a9a isString -> isStringLike
Claus Gittinger <cg@exept.de>
parents: 12387
diff changeset
 16838
    if (__isStringLike(portName)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16839
	__portName = __stringVal(portName);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16840
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16841
	goto failure;
9156
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
    if (__isSmallInteger(baudRate)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16844
	__baudRate = __intVal(baudRate);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16845
    } else if (baudRate == nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16846
	__setBaudRate = 0;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16847
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16848
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16849
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16850
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16851
    if (__isSmallInteger(dataBits)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16852
	__dataBits = __intVal(dataBits);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16853
    } else if (dataBits == nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16854
	__setDataBits = 0;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16855
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16856
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16857
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16858
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16859
    if (__isSmallInteger(xOnChar)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16860
	__xOnChar = __intVal(xOnChar);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16861
    } else if (__isCharacter(xOnChar)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16862
	__xOnChar = __intVal(_characterVal(xOnChar));
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16863
    } else if (xOnChar == nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16864
	__setXOnChar = 0;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16865
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16866
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16867
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16868
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16869
    if (__isSmallInteger(xOffChar)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16870
	__xOffChar = __intVal(xOffChar);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16871
    } else if (__isCharacter(xOffChar)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16872
	__xOffChar = __intVal(_characterVal(xOffChar));
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16873
    } else if (xOffChar == nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16874
	__setXOffChar = 0;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16875
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16876
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16877
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16878
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16879
    if (inFlowCtrlType == @symbol(xOnOff)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16880
	__inFlowCtrl = XONOFF;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16881
    } else if (inFlowCtrlType == @symbol(hardware)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16882
	__inFlowCtrl = HARDWARE;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16883
    } else if (inFlowCtrlType == nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16884
	__setInFlowCtrl = 0;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16885
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16886
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16887
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16888
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16889
    if (outFlowCtrlType == @symbol(xOnOff)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16890
	__outFlowCtrl = XONOFF;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16891
    } else if (outFlowCtrlType == @symbol(hardware)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16892
	__outFlowCtrl = HARDWARE;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16893
    } else if (outFlowCtrlType == nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16894
	__setOutFlowCtrl = 0;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16895
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16896
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16897
    }
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
    if (stopBitsType == @symbol(stop1)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16900
	__stopBits = STOP1;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16901
    } else if (stopBitsType == @symbol(stop2)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16902
	__stopBits = STOP2;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16903
    } else if (stopBitsType == @symbol(stop1_5)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16904
	__stopBits = STOP1_5;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16905
    } else if (stopBitsType == nil) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16906
	__setStopBits = 0;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16907
    } else {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16908
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16909
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16910
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16911
    port = CreateFile(__portName,
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16912
	      GENERIC_READ | GENERIC_WRITE,
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16913
	      0,             /* comm devices must be opened with exclusive access */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16914
	      NULL,          /* no security attrs */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16915
	      OPEN_EXISTING, /* comm devices must use OPEN_EXISTING */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16916
	      0,             /* no overlapped I/O */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16917
	      NULL           /* hTemplate must be NULL for comm devices */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16918
	   );
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16919
    if (port == INVALID_HANDLE_VALUE) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16920
	console_fprintf(stderr, "Win32OS [info]: serial port open failed\n");
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16921
	errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16922
	goto failure;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16923
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16924
    /* Flush the driver */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16925
    PurgeComm( port, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16926
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16927
    /* Set driver buffer sizes */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16928
    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
 16929
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16930
    /* Reset timeout constants */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16931
    timeouts.ReadIntervalTimeout= 0xFFFFFFFF;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16932
    timeouts.ReadTotalTimeoutMultiplier = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16933
    timeouts.ReadTotalTimeoutConstant = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16934
    timeouts.WriteTotalTimeoutMultiplier = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16935
    timeouts.WriteTotalTimeoutConstant = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16936
    SetCommTimeouts( port, &timeouts );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16937
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16938
    /* Set communication parameters */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16939
    ZeroMemory(&dcb, sizeof(dcb));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16940
    dcb.DCBlength = sizeof(dcb);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16941
    GetCommState(port, &dcb);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16942
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16943
    if (__setBaudRate) dcb.BaudRate = __baudRate;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16944
    if (__setDataBits) dcb.ByteSize = __dataBits;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16945
    if (__setXOnChar)  dcb.XonChar = __xOnChar;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16946
    if (__setXOffChar) dcb.XoffChar = __xOffChar;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16947
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16948
    if (__setStopBits) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16949
	/* set stop bits */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16950
	switch(__stopBits) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16951
	    case STOP1_5: dcb.StopBits = 1; break; /* 1.5 stop bits */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16952
	    case STOP1: dcb.StopBits = 0; break; /* 1 stop bit */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16953
	    case STOP2: dcb.StopBits = 2; break; /* 2 stop bits */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16954
	    default: goto errExit;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16955
	}
9156
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
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16958
    if (__setParityType) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16959
	/* set parity */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16960
	switch(__parityType) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16961
	    case NONE: dcb.Parity = NOPARITY; break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16962
	    case ODD: dcb.Parity = ODDPARITY; break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16963
	    case EVEN: dcb.Parity = EVENPARITY; break;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16964
	    default: goto errExit;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16965
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16966
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16967
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16968
    if (__setInFlowCtrl) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16969
	/* set control flow */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16970
	dcb.fInX = FALSE;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16971
	dcb.fDtrControl = FALSE;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16972
	if (__inFlowCtrl == XONOFF) dcb.fInX = TRUE;  /* XOn/XOff handshaking */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16973
	if (__inFlowCtrl == HARDWARE) dcb.fDtrControl = TRUE;  /* hardware handshaking */
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16974
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16975
    if (__setOutFlowCtrl) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16976
	dcb.fOutX = FALSE;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16977
	dcb.fOutxCtsFlow = FALSE;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16978
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16979
	if (__outFlowCtrl == XONOFF) dcb.fOutX = TRUE;  /* XOn/XOff handshaking */
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16980
	if (__outFlowCtrl == HARDWARE) dcb.fOutxCtsFlow = TRUE;  /* hardware handshaking */
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16981
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16982
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16983
    if (SetCommState(port, &dcb)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 16984
	RETURN( true );
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16985
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16986
10352
f2e9bb8906db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10342
diff changeset
 16987
    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
 16988
    errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16989
    /* fall into */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16990
errExit: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16991
    CloseHandle(port);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16992
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16993
failure: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16994
#   undef XONOFF
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16995
#   undef HARDWARE
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16996
#   undef STOP1
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16997
#   undef STOP2
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16998
#   undef STOP1_5
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 16999
#   undef ODD
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17000
#   undef EVEN
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17001
#   undef NONE
9088
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 17002
%}.
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 17003
    errorNumber isNil ifTrue:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17004
	self error:'invalid argument(s)'.
9088
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 17005
    ] ifFalse:[
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17006
	(OperatingSystem errorHolderForNumber:errorNumber) reportError
9088
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 17007
    ].
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17008
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17009
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17010
!Win32OperatingSystem::Win32SerialPortHandle methodsFor:'release'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17011
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17012
closeFile
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17013
    "close the handle"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17014
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17015
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17016
    HANDLE port = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17017
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17018
    if (port) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17019
	__externalAddressVal(self) = (HANDLE)0;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17020
	PurgeComm( port, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR );
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17021
	CloseHandle(port);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17022
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17023
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17024
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17025
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17026
!Win32OperatingSystem::Win32SerialPortHandle methodsFor:'setup'!
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
baudRate:newRate
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17029
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17030
    HANDLE port = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17031
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17032
    if (port
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17033
     && __isSmallInteger(newRate)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17034
	DCB dcb;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17035
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17036
	ZeroMemory(&dcb, sizeof(dcb));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17037
	dcb.DCBlength = sizeof(dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17038
	GetCommState(port, &dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17039
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17040
	dcb.BaudRate = __intVal(newRate);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17041
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17042
	if (! SetCommState(port, &dcb)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17043
	    RETURN(false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17044
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17045
	RETURN(true);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17046
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17047
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17048
    self primitiveFailed.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17049
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17050
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17051
dataBits:newNumberOfBits
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17052
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17053
    HANDLE port = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17054
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17055
    if (port
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17056
     && __isSmallInteger(newNumberOfBits)) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17057
	DCB dcb;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17058
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17059
	ZeroMemory(&dcb, sizeof(dcb));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17060
	dcb.DCBlength = sizeof(dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17061
	GetCommState(port, &dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17062
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17063
	dcb.ByteSize = __intVal(newNumberOfBits);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17064
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17065
	if (! SetCommState(port, &dcb)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17066
	    RETURN(false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17067
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17068
	RETURN(true);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17069
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17070
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17071
    self primitiveFailed.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17072
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17073
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17074
parityType:newParityTypeSymbol
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17075
    "newParityTypeSymbol must be one of #odd, #even or #none (or nil)"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17076
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17077
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17078
    HANDLE port = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17079
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17080
    if (port) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17081
	DCB dcb;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17082
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17083
	ZeroMemory(&dcb, sizeof(dcb));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17084
	dcb.DCBlength = sizeof(dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17085
	GetCommState(port, &dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17086
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17087
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17088
	if ((newParityTypeSymbol == nil) || (newParityTypeSymbol == @symbol(none))) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17089
	    dcb.Parity = NOPARITY;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17090
	} else if (newParityTypeSymbol == @symbol(odd)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17091
	    dcb.Parity = ODDPARITY;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17092
	} else if (newParityTypeSymbol == @symbol(even)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17093
	    dcb.Parity = EVENPARITY;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17094
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17095
	    goto failure;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17096
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17097
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17098
	if (! SetCommState(port, &dcb)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17099
	    RETURN(false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17100
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17101
	RETURN(true);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17102
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17103
  failure: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17104
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17105
    self primitiveFailed.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17106
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17107
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17108
stopBitsType:newStopBitsSymbol
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17109
    "newParityTypeSymbol must be one of #stop1, #stop2 or #stop1_5"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17110
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17111
    HANDLE port = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17112
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17113
    if (port) {
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17114
	DCB dcb;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17115
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17116
	ZeroMemory(&dcb, sizeof(dcb));
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17117
	dcb.DCBlength = sizeof(dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17118
	GetCommState(port, &dcb);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17119
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17120
	if (newStopBitsSymbol == @symbol(stop1)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17121
	    dcb.Parity = 0 /* STOP1 */;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17122
	} else if (newStopBitsSymbol == @symbol(stop2)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17123
	    dcb.Parity = 2 /* STOP2 */;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17124
	} else if (newStopBitsSymbol == @symbol(stop1_5)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17125
	    dcb.Parity = 1 /* STOP1_5 */;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17126
	} else {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17127
	    goto failure;
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17128
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17129
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17130
	if (! SetCommState(port, &dcb)) {
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17131
	    RETURN(false);
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17132
	}
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17133
	RETURN(true);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17134
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17135
  failure: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17136
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17137
    self primitiveFailed.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17138
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17139
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17140
!Win32OperatingSystem::Win32SocketHandle class methodsFor:'constants'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17141
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17142
protocolCodeOf:aNameOrNumber
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17143
    "q&d hack for unix-compatibility"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17144
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17145
    aNameOrNumber isNumber ifTrue:[^ aNameOrNumber].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17146
    aNameOrNumber isNil ifTrue:[^ aNameOrNumber].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17147
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17148
    aNameOrNumber = 'tcp' ifTrue:[^ 6].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17149
    aNameOrNumber = 'udp' ifTrue:[^ 17].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17150
    aNameOrNumber = 'raw' ifTrue:[^ 255].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17151
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17152
    self error:'unsupported protocol' mayProceed:true.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17153
    ^ nil.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17154
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17155
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17156
     self protocolCodeOf:#tcp
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17157
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17158
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17159
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17160
protocolSymbolOf:anInteger
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17161
    "q&d hack for unix-compatibility"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17162
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17163
    anInteger isNil ifTrue:[^ nil].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17164
    anInteger isSymbol ifTrue:[^ anInteger].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17165
14889
eaddf47af679 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14854
diff changeset
 17166
    anInteger ==   0 ifTrue:[ ^ #ip ].
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17167
    anInteger ==   6 ifTrue:[ ^ #tcp ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17168
    anInteger ==  17 ifTrue:[ ^ #udp ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17169
    anInteger == 255 ifTrue:[ ^ #raw ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17170
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17171
    self error:'unsupported protocol' mayProceed:true.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17172
    ^ nil.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17173
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17174
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17175
     self protocolSymbolOf:6
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 17176
    "
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 17177
! !
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 17178
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 17179
!Win32OperatingSystem::Win32SocketHandle class methodsFor:'queries'!
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 17180
16289
78bd98e104bb class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16285
diff changeset
 17181
getAddressInfo:hostNameOrNil serviceName:serviceNameOrNil domain:domainArg type:typeArg protocol:protoArg flags:flags
78bd98e104bb class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16285
diff changeset
 17182
    "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
 17183
     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
 17184
     addresses to be returned."
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 17185
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17186
    |error errorString result domain type proto hostName serviceName port|
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17187
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17188
    domain := OperatingSystem domainCodeOf:domainArg.
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17189
    type := OperatingSystem socketTypeCodeOf:typeArg.
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17190
    proto := self protocolCodeOf:protoArg.
16289
78bd98e104bb class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16285
diff changeset
 17191
    serviceNameOrNil notNil ifTrue:[
78bd98e104bb class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16285
diff changeset
 17192
        serviceName := serviceNameOrNil printString.      "convert integer port numbers"
78bd98e104bb class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16285
diff changeset
 17193
        serviceNameOrNil isInteger ifTrue:[
78bd98e104bb class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16285
diff changeset
 17194
            port := serviceNameOrNil.
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17195
        ].
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 17196
    ]. "ifFalse:[serviceName := nil]"
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17197
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17198
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17199
%{
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17200
#if 1 || !defined(AI_NUMERICHOST)
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17201
%}.
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17202
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17203
    "have to convert serviceName and hostName to single byte strings
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17204
     until we implement getAddrInfoW() for Borland C.
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17205
     If we really have 16-bit hostnames, this fails with #primitiveFailed"
16289
78bd98e104bb class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16285
diff changeset
 17206
    hostNameOrNil notNil ifTrue:[
78bd98e104bb class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16285
diff changeset
 17207
        hostName := hostNameOrNil asSingleByteStringIfPossible.
78bd98e104bb class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16285
diff changeset
 17208
    ].  "ifFalse:[hostName := nil] is nil anyway"
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17209
    serviceName notNil ifTrue:[
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17210
        serviceName := serviceName asSingleByteStringIfPossible.
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17211
    ].
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17212
%{
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17213
#endif // !AI_NUMERICHOST
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17214
%}.
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17215
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17216
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17217
%{ /* STACK:32000 */
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17218
#if !defined(NO_SOCKET)
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17219
    char *__hostName, *__serviceName;
15580
4f1aa9df6162 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15547
diff changeset
 17220
    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
 17221
    int ret;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 17222
    int cnt = 0;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17223
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17224
    if (hostName == nil) {
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17225
        __hostName = 0;
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 17226
    } else if (__isStringLike(hostName)) {
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17227
        strncpy(__hostNameCopy, __stringVal(hostName), sizeof(__hostNameCopy)-1);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17228
        __hostName = __hostNameCopy;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17229
    } else if (__isUnicode16String(hostName)) {
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17230
        error = @symbol(unsupportedUnicodeName);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17231
        errorString = __MKSTRING("Unicode hostnames are not yet supported");
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17232
        goto exitPrim;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17233
    } else {
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17234
        error = @symbol(badArgument1);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17235
        goto exitPrim;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17236
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17237
    if (serviceName == nil) {
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17238
        __serviceName = 0;
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 17239
    } else if (__isStringLike(serviceName)) {
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17240
        strncpy(__serviceNameCopy, __stringVal(serviceName), sizeof(__serviceNameCopy)-1);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17241
        __serviceName = __serviceNameCopy;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17242
    } else {
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17243
        error = @symbol(badArgument2);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17244
        goto exitPrim;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17245
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17246
    if (__hostName == 0 && __serviceName == 0) {
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17247
        error = @symbol(badArgument);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17248
        goto exitPrim;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17249
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17250
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17251
{
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17252
# if defined(AI_NUMERICHOST)
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17253
    /*
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17254
     * Use getaddrinfo()
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17255
     */
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17256
# ifndef __VISUALC__
15580
4f1aa9df6162 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 15547
diff changeset
 17257
    extern getaddrinfo();
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17258
# endif
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17259
    struct addrinfo hints;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17260
    struct addrinfo *info = NULL, *infop;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17261
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17262
    memset(&hints, 0, sizeof(hints));
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17263
    if (__isSmallInteger(domain))
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17264
        hints.ai_family = __intVal(domain);
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17265
    if (__isSmallInteger(type))
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17266
        hints.ai_socktype = __intVal(type);
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17267
    if (__isSmallInteger(proto))
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17268
        hints.ai_protocol = __intVal(proto);
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17269
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17270
    do {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17271
# ifdef DO_WRAP_CALLS
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17272
        do {
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17273
            __threadErrno = 0;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17274
            // do not cast to INT - will loose sign bit then!
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17275
            ret = STX_WSA_NOINT_CALL4( "getaddrinfo", getaddrinfo, __hostName, __serviceName, &hints, &info);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17276
        } while ((ret < 0) && (__threadErrno == EINTR));
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17277
# else
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17278
        __BEGIN_INTERRUPTABLE__
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17279
        ret = getaddrinfo(__hostName, __serviceName, &hints, &info);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17280
        __END_INTERRUPTABLE__
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17281
# endif
14852
f8cf16374fd5 Fix getnameinfo() and getaddrinfo() #ifdefed code
Stefan Vogel <sv@exept.de>
parents: 14849
diff changeset
 17282
    } while (ret != 0 && __threadErrno == EINTR);
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17283
    if (ret != 0) {
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17284
        switch (ret) {
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17285
        case EAI_FAMILY:
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17286
            error = @symbol(badProtocol);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17287
            break;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17288
        case EAI_SOCKTYPE:
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17289
            error = @symbol(badSocketType);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17290
            break;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17291
        case EAI_BADFLAGS:
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17292
            error = @symbol(badFlags);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17293
            break;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17294
        case EAI_NONAME:
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17295
            error = @symbol(unknownHost);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17296
            break;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17297
        case EAI_SERVICE:
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17298
            error = @symbol(unknownService);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17299
            break;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17300
        case EAI_MEMORY:
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17301
            error = @symbol(allocationFailure);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17302
            break;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17303
        case EAI_FAIL:
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17304
            error = @symbol(permanentFailure);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17305
            break;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17306
        case EAI_AGAIN:
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17307
            error = @symbol(tryAgain);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17308
            break;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17309
        default:
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17310
            error = @symbol(unknownError);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17311
        }
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17312
        errorString = __MKSTRING(gai_strerror(ret));
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17313
        goto err;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17314
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17315
    for (cnt=0, infop=info; infop; infop=infop->ai_next)
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17316
        cnt++;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17317
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17318
    result = __ARRAY_NEW_INT(cnt);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17319
    if (result == nil) {
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17320
        error = @symbol(allocationFailure);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17321
        goto err;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17322
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17323
    for (infop=info, cnt=0; infop; infop=infop->ai_next, cnt++) {
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17324
        OBJ o, resp;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17325
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17326
        resp = __ARRAY_NEW_INT(6);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17327
        if (resp == nil) {
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17328
            error = @symbol(allocationFailure);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17329
            goto err;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17330
        }
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17331
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17332
        __ArrayInstPtr(result)->a_element[cnt] = resp; __STORE(result, resp);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17333
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17334
        __ArrayInstPtr(resp)->a_element[0] = __mkSmallInteger(infop->ai_flags);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17335
        __ArrayInstPtr(resp)->a_element[1] = __mkSmallInteger(infop->ai_family);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17336
        __ArrayInstPtr(resp)->a_element[2] = __mkSmallInteger(infop->ai_socktype);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17337
        __ArrayInstPtr(resp)->a_element[3] = __mkSmallInteger(infop->ai_protocol);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17338
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17339
        __PROTECT__(resp);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17340
        o = __BYTEARRAY_NEW_INT(infop->ai_addrlen);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17341
        __UNPROTECT__(resp);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17342
        if (o == nil) {
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17343
            error = @symbol(allocationFailure);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17344
            goto err;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17345
        }
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17346
        memcpy(__byteArrayVal(o), infop->ai_addr, infop->ai_addrlen);
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17347
       __ArrayInstPtr(resp)->a_element[4] = o; __STORE(resp, o);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17348
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17349
        if (infop->ai_canonname) {
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17350
            __PROTECT__(resp);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17351
            o = __MKSTRING(infop->ai_canonname);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17352
            __UNPROTECT__(resp);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17353
            if (o == nil) {
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17354
                error = @symbol(allocationFailure);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17355
                goto err;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17356
            }
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17357
            __ArrayInstPtr(resp)->a_element[5] = o; __STORE(resp, o);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17358
        }
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17359
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17360
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17361
err:
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17362
    if (info) freeaddrinfo(info);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17363
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17364
# else /* ! AI_NUMERICHOST =============================================================*/
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17365
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17366
    /*
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17367
     * Use getservbyname() / gethostByName()
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17368
     */
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17369
    struct hostent *hp;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17370
    char **addrpp;
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 17371
    int __port = 0;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17372
    int i;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17373
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 17374
    if (__isSmallInteger(port)) {
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17375
        __port = htons(__smallIntegerVal(port));
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 17376
    } else if (__serviceName) {
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17377
        struct servent *sp;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17378
        char *__proto = 0;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17379
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17380
        if (__isStringLike(protoArg))
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17381
            __proto = __stringVal(protoArg);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17382
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17383
        sp = getservbyname(__serviceName, __proto);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17384
        if (sp == NULL) {
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17385
            __port = atoi(__serviceName);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17386
            if (__port <= 0) {
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17387
                errorString = @symbol(unknownService);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17388
                error = __mkSmallInteger(-3);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17389
                goto err;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17390
            }
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17391
            __port = htons(__port);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17392
        } else
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17393
            __port = sp->s_port;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17394
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17395
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17396
    if (__hostName) {
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17397
        int err;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17398
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17399
        do {
15604
86e0ba23123f class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15598
diff changeset
 17400
# if 0 && defined(DO_WRAP_CALLS)
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17401
            /* This does not work - the structure is allocated in thread local storage */
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17402
            hp = STX_WSA_NOINT_CALL1("gethostbyname", gethostbyname, __hostName);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17403
            if ((INT)hp < 0) hp = NULL;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17404
# else
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17405
            /* __BEGIN_INTERRUPTABLE__ is dangerous, because gethostbyname
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17406
             * uses a static data area, but allocates it in thread local storage
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17407
             */
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17408
            // __BEGIN_INTERRUPTABLE__
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17409
            hp = gethostbyname(__hostName);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17410
            // __END_INTERRUPTABLE__
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17411
#endif
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17412
        } while ((hp == NULL
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17413
                  && (err = WSAGetLastError()) == EINTR
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17414
                      || err == TRY_AGAIN));
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17415
        if (hp == 0) {
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17416
            switch (err) {
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17417
            case HOST_NOT_FOUND:
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17418
                errorString = @symbol(unknownHost);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17419
                break;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17420
            case NO_ADDRESS:
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17421
                errorString = @symbol(noAddress);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17422
                break;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17423
            case NO_RECOVERY:
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17424
                errorString = @symbol(permanentFailure);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17425
                break;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17426
            case TRY_AGAIN:
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17427
                errorString = @symbol(tryAgain);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17428
                break;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17429
            default:
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17430
                errorString = @symbol(unknownError);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17431
                break;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17432
            }
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17433
            error = __mkSmallInteger(err);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17434
            goto err;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17435
        }
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17436
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17437
        if (__isSmallInteger(domain) && hp->h_addrtype != __smallIntegerVal(domain)) {
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17438
            errorString = @symbol(unknownHost);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17439
            error = __mkSmallInteger(-2);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17440
            goto err;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17441
        }
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17442
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17443
        for (cnt = 0, addrpp = hp->h_addr_list; *addrpp; addrpp++)
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17444
            cnt++;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17445
        addrpp = hp->h_addr_list;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17446
    } else {
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17447
        cnt = 1;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17448
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17449
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17450
    result = __ARRAY_NEW_INT(cnt);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17451
    if (result == nil) {
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17452
        error = @symbol(allocationFailure);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17453
        goto err;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17454
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17455
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17456
    for (i = 0; i < cnt; i++) {
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17457
        OBJ o, resp;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17458
        struct sockaddr_in *sa;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17459
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17460
        resp = __ARRAY_NEW_INT(6);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17461
        if (resp == nil) {
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17462
            error = @symbol(allocationFailure);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17463
            goto err;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17464
        }
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17465
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17466
        __ArrayInstPtr(result)->a_element[i] = resp; __STORE(result, resp);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17467
        __ArrayInstPtr(resp)->a_element[0] = __mkSmallInteger(0);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17468
        __ArrayInstPtr(resp)->a_element[2] = type; __STORE(resp, type);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17469
        __ArrayInstPtr(resp)->a_element[3] = proto; __STORE(resp, proto);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17470
        __PROTECT__(resp);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17471
        o = __BYTEARRAY_NEW_INT(sizeof(*sa));
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17472
        __UNPROTECT__(resp);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17473
        if (o == nil) {
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17474
            error = @symbol(allocationFailure);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17475
            goto err;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17476
        }
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17477
        __ArrayInstPtr(resp)->a_element[4] = o; __STORE(resp, o);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17478
        sa = (struct sockaddr_in *)__byteArrayVal(o);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17479
        sa->sin_port = __port;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17480
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17481
        if (__hostName) {
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17482
            sa->sin_family = hp->h_addrtype;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17483
            memcpy(&sa->sin_addr, *addrpp, hp->h_length);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17484
            __ArrayInstPtr(resp)->a_element[1] = __mkSmallInteger(hp->h_addrtype);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17485
            if (hp->h_name) {
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17486
                __PROTECT__(resp);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17487
                o = __MKSTRING(hp->h_name);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17488
                __UNPROTECT__(resp);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17489
                if (o == nil) {
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17490
                    error = @symbol(allocationFailure);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17491
                    goto err;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17492
                }
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17493
                __ArrayInstPtr(resp)->a_element[5] = o; __STORE(resp, o);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17494
            }
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17495
            addrpp++;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17496
        } else{
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17497
            if (__isSmallInteger(domain))
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17498
                sa->sin_family = __intVal(domain);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17499
            else
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17500
                sa->sin_family = AF_INET;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17501
            __ArrayInstPtr(resp)->a_element[1] = domain; __STORE(resp, domain);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17502
        }
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17503
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17504
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17505
err:;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17506
# endif /* ! AI_NUMERICHOST */
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17507
}
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17508
#else /* ! HAS_SOCKET */
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17509
    error = @symbol(notImplemented);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17510
#endif
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 17511
exitPrim:;
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17512
%}.
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17513
    error notNil ifTrue:[
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17514
        |request|
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17515
        request := SocketAddressInfo new
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17516
            domain:domainArg;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17517
            type:typeArg;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17518
            protocol:protoArg;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17519
            canonicalName:hostName;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17520
            serviceName:serviceName.
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17521
        ^ (HostNameLookupError new
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17522
                parameter:error;
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17523
                messageText:' - ', (errorString ? error printString);
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17524
                request:request) raiseRequest.
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 17525
    ].
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17526
    1 to:result size do:[:i |
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17527
        |entry dom info|
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17528
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17529
        info := SocketAddressInfo new.
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17530
        entry := result at:i.
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17531
        info flags:(entry at:1).
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17532
        info domain:(dom := OperatingSystem domainSymbolOf:(entry at:2)).
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17533
        info type:(OperatingSystem socketTypeSymbolOf:(entry at:3)).
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17534
        info protocol:(self protocolSymbolOf:(entry at:4)).
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17535
        info socketAddress:((SocketAddress newDomain:dom) fromBytes:(entry at:5)).
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17536
        info canonicalName:(entry at:6).
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17537
        result at:i put:info
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 17538
    ].
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17539
    ^ result
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17540
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17541
    "
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17542
     self getAddressInfo:'localhost' serviceName:nil
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17543
            domain:nil type:nil protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17544
     self getAddressInfo:'localhost' serviceName:nil
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17545
            domain:#AF_INET type:#stream protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17546
     self getAddressInfo:'localhost' serviceName:nil
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17547
            domain:#AF_INET type:#stream protocol:#tcp flags:nil
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 17548
     self getAddressInfo:'localhost' serviceName:10
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17549
            domain:#AF_INET type:#stream protocol:#tcp flags:nil
10792
46d6f7358405 Win32SocketHandle>>#getAddressInfo:...
Stefan Vogel <sv@exept.de>
parents: 10775
diff changeset
 17550
     self getAddressInfo:'localhost' serviceName:'10'
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17551
            domain:#AF_INET type:#stream protocol:#tcp flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17552
     self getAddressInfo:'blurb.exept.de' serviceName:nil
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17553
            domain:#AF_INET type:nil protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17554
     self getAddressInfo:'1.2.3.4' serviceName:'bla'
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17555
            domain:#AF_INET type:nil protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17556
     self getAddressInfo:'localhost' serviceName:'echo'
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17557
            domain:#AF_INET type:nil protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17558
     self getAddressInfo:nil serviceName:'echo'
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17559
            domain:#AF_INET type:nil protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17560
     self getAddressInfo:nil serviceName:nil
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17561
            domain:#AF_INET type:nil protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17562
     self getAddressInfo:'www.google.de' serviceName:nil
16285
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17563
            domain:nil type:nil protocol:nil flags:nil
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17564
     self getAddressInfo:'exeptn' serviceName:nil
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17565
            domain:nil type:nil protocol:nil flags:nil
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17566
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17567
     self getAddressInfo:'localhost' asUnicode16String serviceName:nil
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17568
            domain:nil type:nil protocol:nil flags:nil
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17569
     self getAddressInfo:'ützlbrützl' serviceName:nil
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17570
            domain:nil type:nil protocol:nil flags:nil
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17571
     self getAddressInfo:'ützlbrützl' serviceName:nil
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17572
            domain:nil type:nil protocol:nil flags:nil
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17573
     self getAddressInfo:'путин.ру' asUnicode16String serviceName:nil
d8b8eb36dbed class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16279
diff changeset
 17574
            domain:nil type:nil protocol:nil flags:nil
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 17575
    "
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17576
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17577
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17578
getNameInfo:socketAddress wantHostName:wantHostName wantServiceName:wantServiceName datagram:useDatagram flags:flags
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17579
    "answer an Array containing the hostName and serviceName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17580
     in socketAddress.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17581
     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
 17582
     this returns multiple hostnames (if appropriate)"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17583
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17584
    |error errorString hostName serviceName|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17585
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17586
%{  /* STACK:32000 */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17587
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17588
#if !defined(NO_SOCKET)
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17589
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17590
# ifndef NI_MAXHOST
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17591
#  define NI_MAXHOST 256
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17592
#  define NI_MAXSERV 64
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17593
# endif
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17594
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17595
    char host[NI_MAXHOST];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17596
    char service[NI_MAXSERV];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17597
    char *hp = 0, *sp = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17598
    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
 17599
    int ret;
196ec3fc8a66 WIN32: explicitely make stdin,out and err inheritable when creating a subprocess.
Claus Gittinger <cg@exept.de>
parents: 15506
diff changeset
 17600
    int __flags;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17601
    char *bp;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17602
    int nInstBytes, sockAddrSize;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17603
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17604
    if (wantHostName == true) {
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17605
	hp = host;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17606
	hsz = sizeof(host);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17607
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17608
    if (wantServiceName == true) {
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17609
	sp = service;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17610
	ssz = sizeof(service);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17611
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17612
    if (hp == 0 && sp == 0) {
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17613
	error = @symbol(badArgument);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17614
	goto err;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17615
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17616
    if (!__isBytes(socketAddress)) {
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17617
	error = @symbol(badArgument1);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17618
	goto err;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17619
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17620
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17621
    nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(socketAddress))->c_ninstvars));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17622
    sockAddrSize = __byteArraySize(socketAddress);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17623
    sockAddrSize -= nInstBytes;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17624
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17625
    if (!__isSmallInteger(flags)) {
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17626
	error = @symbol(badArgument5);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17627
	goto err;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17628
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17629
    __flags = __intVal(flags);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17630
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17631
#if defined(NI_NUMERICHOST)
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17632
    if (useDatagram == true) {
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17633
	__flags |= NI_DGRAM;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17634
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17635
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17636
    {
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17637
# ifndef __VISUALC__
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17638
	extern getnameinfo();
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17639
#endif
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17640
	bp = (char *)(__byteArrayVal(socketAddress));
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17641
	bp += nInstBytes;
14852
f8cf16374fd5 Fix getnameinfo() and getaddrinfo() #ifdefed code
Stefan Vogel <sv@exept.de>
parents: 14849
diff changeset
 17642
# ifdef DO_WRAP_CALLS
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17643
	do {
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17644
	    __threadErrno = 0;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17645
	    // do not cast to INT - will loose sign bit then!
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17646
	    ret = STX_WSA_NOINT_CALL7( "getnameinfo", getnameinfo, (struct sockaddr *)bp, sockAddrSize, hp, hsz, sp, ssz, __flags);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17647
	} while ((ret < 0) && (__threadErrno == EINTR));
14852
f8cf16374fd5 Fix getnameinfo() and getaddrinfo() #ifdefed code
Stefan Vogel <sv@exept.de>
parents: 14849
diff changeset
 17648
# else
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17649
	__BEGIN_INTERRUPTABLE__
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17650
	ret = getnameinfo((struct sockaddr *)bp, sockAddrSize,
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17651
			  hp, hsz, sp, ssz, __flags);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17652
	__END_INTERRUPTABLE__
14852
f8cf16374fd5 Fix getnameinfo() and getaddrinfo() #ifdefed code
Stefan Vogel <sv@exept.de>
parents: 14849
diff changeset
 17653
# endif
f8cf16374fd5 Fix getnameinfo() and getaddrinfo() #ifdefed code
Stefan Vogel <sv@exept.de>
parents: 14849
diff changeset
 17654
    } while (ret != 0 && __threadErrno == EINTR);
f8cf16374fd5 Fix getnameinfo() and getaddrinfo() #ifdefed code
Stefan Vogel <sv@exept.de>
parents: 14849
diff changeset
 17655
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17656
    if (ret != 0) {
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17657
	switch (ret) {
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17658
	    case EAI_FAMILY:
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17659
		error = @symbol(badProtocol);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17660
		break;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17661
	    case EAI_SOCKTYPE:
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17662
		error = @symbol(badSocketType);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17663
		break;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17664
	    case EAI_BADFLAGS:
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17665
		error = @symbol(badFlags);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17666
		break;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17667
	    case EAI_NONAME:
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17668
		error = @symbol(unknownHost);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17669
		break;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17670
	    case EAI_SERVICE:
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17671
		error = @symbol(unknownService);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17672
		break;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17673
	    case EAI_MEMORY:
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17674
		error = @symbol(allocationFailure);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17675
		break;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17676
	    case EAI_FAIL:
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17677
		error = @symbol(permanentFailure);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17678
		break;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17679
	    case EAI_AGAIN:
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17680
		error = @symbol(tryAgain);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17681
		break;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17682
	    default:
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17683
		error = @symbol(unknownError);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17684
	}
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17685
	errorString = __MKSTRING(gai_strerror(ret));
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17686
	goto err;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17687
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17688
# else /* ! NI_NUMERICHOST */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17689
    {
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17690
	/*
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17691
	 * Do it using gethostbyaddr()
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17692
	 */
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17693
	struct sockaddr_in *sa;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17694
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17695
	if (sockAddrSize < sizeof(*sa)) {
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17696
	    error = @symbol(badArgument1);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17697
	    goto err;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17698
	}
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17699
	bp = (char *)(__byteArrayVal(socketAddress));
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17700
	bp += nInstBytes;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17701
	sa = (struct sockaddr_in *)bp;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17702
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17703
	if (sp) {
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17704
	    struct servent *servp;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17705
	    char *__proto = 0;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17706
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17707
	    __proto = (useDatagram == true ? "udp" : "tcp");
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17708
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17709
	    servp = getservbyport(sa->sin_port, __proto);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17710
	    if (servp) {
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17711
		sp = servp->s_name;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17712
	    }
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17713
	}
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17714
	if (hp) {
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17715
	    struct hostent *hostp;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17716
	    int err;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17717
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17718
	    do {
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17719
		/* must refetch in loop */
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17720
		bp = (char *)(__byteArrayVal(socketAddress));
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17721
		bp += nInstBytes;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17722
		sa = (struct sockaddr_in *)bp;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17723
		/* __BEGIN_INTERRUPTABLE__ is dangerous, because gethostbyname uses a static data area
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17724
		 */
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17725
		hostp = gethostbyaddr((char *)&sa->sin_addr, sockAddrSize, sa->sin_family);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17726
		/* __END_INTERRUPTABLE__ */
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17727
	    } while ((hostp == NULL)
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17728
		      && ((err = WSAGetLastError()) == TRY_AGAIN
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17729
			  || err == EINTR
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17730
			 )
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17731
	    );
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17732
	    if (hostp == 0) {
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17733
		switch (err) {
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17734
		case HOST_NOT_FOUND:
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17735
		    errorString = @symbol(unknownHost);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17736
		    break;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17737
		case NO_ADDRESS:
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17738
		    errorString = @symbol(noAddress);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17739
		    break;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17740
		case NO_RECOVERY:
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17741
		    errorString = @symbol(permanentFailure);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17742
		    break;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17743
		case TRY_AGAIN:
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17744
		    errorString = @symbol(tryAgain);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17745
		    break;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17746
		default:
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17747
		    errorString = @symbol(unknownError);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17748
		    break;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17749
		}
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17750
		error = __mkSmallInteger(err);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17751
		goto err;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17752
	    }
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17753
	    hp = hostp->h_name;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17754
	}
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
# endif /* ! NI_NUMERICHOST */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17757
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17758
    if (hp)
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17759
	hostName = __MKSTRING(hp);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17760
    if (sp)
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17761
	serviceName = __MKSTRING(sp);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17762
err:;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17763
#else
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17764
    error = @symbol(notImplemented);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17765
#endif
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
    error notNil ifTrue:[
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17768
	error isSymbol ifTrue:[
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17769
	    self primitiveFailed:error.
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17770
	].
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17771
	^ (HostAddressLookupError new
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17772
		parameter:error;
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17773
		messageText:' - ', (errorString ? error printString);
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17774
		request:thisContext message) raiseRequest.
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
    ^ Array with:hostName with:serviceName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17778
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17779
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17780
     self getNameInfo:
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17781
	(self getAddressInfo:'localhost' serviceName:'echo'
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17782
		domain:#AF_INET type:#stream protocol:nil flags:nil) first socketAddress
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17783
	 wantHostName:true wantServiceName:true datagram:false flags:0
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17784
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17785
     self getNameInfo:
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17786
	(self getAddressInfo:'exept.exept.de' serviceName:'echo'
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17787
		domain:#AF_INET type:#stream protocol:nil flags:nil) first socketAddress
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17788
	 wantHostName:true wantServiceName:true datagram:false flags:0
15604
86e0ba23123f class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15598
diff changeset
 17789
86e0ba23123f class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 15598
diff changeset
 17790
     self getNameInfo:(IPSocketAddress hostAddress:#[1 2 3 4])
15779
e0acc4cc5a08 fix for visualC
Claus Gittinger <cg@exept.de>
parents: 15604
diff changeset
 17791
	 wantHostName:true wantServiceName:true datagram:false flags:0
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 17792
    "
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 17793
! !
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 17794
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17795
!Win32OperatingSystem::WinPointStructure class methodsFor:'instance creation'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17796
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17797
new
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17798
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17799
^super new: self sizeInBytes
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17800
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17801
    "Created: / 03-08-2006 / 10:37:59 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17802
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17803
10287
51f1d52fe128 localtime() for Borland CC, localtime_s() for visual c++
Stefan Vogel <sv@exept.de>
parents: 10286
diff changeset
 17804
sizeInBytes
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17805
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17806
^8
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17807
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17808
    "Created: / 03-08-2006 / 10:38:06 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17809
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17810
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17811
!Win32OperatingSystem::WinPointStructure methodsFor:'accessing'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17812
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17813
asPoint
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17814
	"Private - Answer the receiver as a Point."
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17815
    ^self x @ self y
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17816
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17817
    "Created: / 03-08-2006 / 10:45:55 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17818
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17819
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17820
x
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17821
	"Private - Answer the x coordinate of the point."
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17822
    ^self longAt: 0 + 1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17823
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17824
    "Created: / 03-08-2006 / 10:46:11 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17825
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17826
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17827
x: anInteger
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17828
	"Private - Set the x coordinate of the point."
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17829
    self longAt: 0 + 1 put: anInteger
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17830
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17831
    "Created: / 03-08-2006 / 10:46:41 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17832
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17833
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17834
y
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17835
	"Private - Answer the y coordinate of the point."
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17836
    ^self longAt: 4 + 1
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17837
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17838
    "Created: / 03-08-2006 / 10:46:26 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17839
!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17840
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17841
y: anInteger
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17842
	"Private - Set the y coordinate of the point."
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17843
    self longAt: 4 + 1 put: anInteger
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17844
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17845
    "Created: / 03-08-2006 / 10:46:56 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17846
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17847
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17848
!Win32OperatingSystem::WinPointStructure methodsFor:'printing'!
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17849
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17850
printOn: aStream
13742
cfb6a76de348 version_CVS
Claus Gittinger <cg@exept.de>
parents: 13618
diff changeset
 17851
	"Append a textual representation of the receiver to aStream."
9475
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17852
    aStream nextPutAll: self class name, ' { ', self asPoint printString, ' } '
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17853
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17854
    "Created: / 03-08-2006 / 10:45:40 / fm"
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17855
! !
c57956a348bf printing support
fm
parents: 9431
diff changeset
 17856
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 17857
!Win32OperatingSystem class methodsFor:'documentation'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 17858
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 17859
version
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 17860
    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.495 2014-04-10 08:54:27 stefan Exp $'
12154
646c4171f0d2 added: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 11920
diff changeset
 17861
!
646c4171f0d2 added: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 11920
diff changeset
 17862
646c4171f0d2 added: #openApplicationForDocument:operation:
Claus Gittinger <cg@exept.de>
parents: 11920
diff changeset
 17863
version_CVS
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 17864
    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.495 2014-04-10 08:54:27 stefan Exp $'
13618
9af72c855037 Fixes for #canExecuteCommand:
vrany
parents: 13616
diff changeset
 17865
!
9af72c855037 Fixes for #canExecuteCommand:
vrany
parents: 13616
diff changeset
 17866
9af72c855037 Fixes for #canExecuteCommand:
vrany
parents: 13616
diff changeset
 17867
version_SVN
16309
6df7a4841fb6 class: Win32OperatingSystem
Stefan Vogel <sv@exept.de>
parents: 16303
diff changeset
 17868
    ^ '$Id: Win32OperatingSystem.st,v 1.495 2014-04-10 08:54:27 stefan Exp $'
13618
9af72c855037 Fixes for #canExecuteCommand:
vrany
parents: 13616
diff changeset
 17869
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 17870
! !
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 17871
14730
a4cc809df4f1 class: Win32OperatingSystem
Claus Gittinger <cg@exept.de>
parents: 14667
diff changeset
 17872
5135
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 17873
Win32OperatingSystem initialize!
10687
ab97bbae07f2 *** empty log message ***
sr
parents: 10686
diff changeset
 17874
Win32OperatingSystem::PerformanceData initialize!
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 17875
Win32OperatingSystem::RegistryEntry initialize!