--- a/Win32OperatingSystem.st Wed Nov 17 01:17:03 2004 +0100
+++ b/Win32OperatingSystem.st Wed Nov 17 02:20:38 2004 +0100
@@ -2699,96 +2699,96 @@
"/ command.com command-line parsing here (sigh).
hasRedirection := false.
(aCommandString isNil or:[aCommandString includesAny:'<>|']) ifTrue:[
- hasRedirection := true
+ hasRedirection := true
].
self isMSWINDOWSNTlike ifTrue:[
- hasRedirection ifFalse:[
- |size name|
-
- "/ test whether the commandString is an executable;
- "/ then, no shell is required
- name := aCommandString withoutSeparators.
- (name notEmpty and:[(name startsWith:$") not]) ifTrue:[
- |index file suffix|
-
- index := name indexOfSeparatorStartingAt:1.
- index ~~ 0 ifTrue:[
- name := name copyFrom:1 to:(index -1).
- ].
-
- file := name asFilename.
- suffix := file suffix.
-
- suffix isEmptyOrNil ifTrue:[
- suffix := 'exe'.
- file := file withSuffix:suffix.
- ].
-
- (file exists and:[suffix = 'exe']) ifTrue:[
- "/ is an executable, no shell required
- ^ Array with:nil with:aCommandString.
- ]
- ].
- ].
- shell := self getEnvironment:'COMSPEC'.
- shell isNil ifTrue:[
- wDir := self getWindowsSystemDirectory asFilename.
- shell := (wDir construct:'cmd.exe').
- shell exists ifFalse:[
- shell := (wDir construct:'command.com').
- shell exists ifFalse:[
- self error:'no command.com available'.
- ]
- ].
- shell := shell pathName.
- ].
- aCommandString isNil ifTrue:[
- ^ Array with:nil with:shell
- ].
-
- ^ Array with:nil with:(shell , ' /c ' , '"' , aCommandString , '"' )
+ hasRedirection ifFalse:[
+ |size name|
+
+ "/ test whether the commandString is an executable;
+ "/ then, no shell is required
+ name := aCommandString withoutSeparators.
+ (name notEmpty and:[(name startsWith:$") not]) ifTrue:[
+ |index file suffix|
+
+ index := name indexOfSeparatorStartingAt:1.
+ index ~~ 0 ifTrue:[
+ name := name copyFrom:1 to:(index -1).
+ ].
+
+ file := name asFilename.
+ suffix := file suffix.
+
+ suffix isEmptyOrNil ifTrue:[
+ suffix := 'exe'.
+ file := file withSuffix:suffix.
+ ].
+
+ (file exists and:[suffix = 'exe']) ifTrue:[
+ "/ is an executable, no shell required
+ ^ Array with:nil with:aCommandString.
+ ]
+ ].
+ ].
+ shell := self getEnvironment:'COMSPEC'.
+ shell isNil ifTrue:[
+ wDir := self getWindowsSystemDirectory asFilename.
+ shell := (wDir construct:'cmd.exe').
+ shell exists ifFalse:[
+ shell := (wDir construct:'command.com').
+ shell exists ifFalse:[
+ self error:'no command.com available'.
+ ]
+ ].
+ shell := shell pathName.
+ ].
+ aCommandString isNil ifTrue:[
+ ^ Array with:nil with:shell
+ ].
+
+ ^ Array with:nil with:(shell , ' /c ' , '"' , aCommandString , '"' )
].
"/ I/O redirection is not yet handled directly
"/ fallBack to command.com (below) to do it.
hasRedirection ifFalse:[
- words := aCommandString asCollectionOfSubstringsSeparatedBy:Character space.
- args := ' '.
- words from:2 to:(words size) do:[:s |
- args := args , (s , ' ').
- ].
-
- path := self pathOfCommand:(words at:1).
- path notNil ifTrue:[
- "/ execute the command directly -
- "/ without going through command.com
-
- self isMSWINDOWSNTlike ifTrue:[
- args := path , args.
- ].
-
- ^ Array with:path with:args
- ].
+ words := aCommandString asCollectionOfSubstringsSeparatedBy:Character space.
+ args := ' '.
+ words from:2 to:(words size) do:[:s |
+ args := args , (s , ' ').
+ ].
+
+ path := self pathOfCommand:(words at:1).
+ path notNil ifTrue:[
+ "/ execute the command directly -
+ "/ without going through command.com
+
+ self isMSWINDOWSNTlike ifTrue:[
+ args := path , args.
+ ].
+
+ ^ Array with:path with:args
+ ].
].
"/ I/O redirection or no executable was found
shell := self getEnvironment:'COMSPEC'.
shell isNil ifTrue:[
- wDir := self getWindowsSystemDirectory asFilename.
- shell := (wDir construct:'cmd.exe').
- shell exists ifFalse:[
- shell := (wDir construct:'command.com').
- shell exists ifFalse:[
- self error:'no command.com available'.
- ]
- ].
- shell := shell pathName.
+ wDir := self getWindowsSystemDirectory asFilename.
+ shell := (wDir construct:'cmd.exe').
+ shell exists ifFalse:[
+ shell := (wDir construct:'command.com').
+ shell exists ifFalse:[
+ self error:'no command.com available'.
+ ]
+ ].
+ shell := shell pathName.
].
aCommandString isNil ifTrue:[
- ^ Array with:shell with:shell
+ ^ Array with:shell with:shell
].
^ Array with:shell with:(shell , ' /c ' , aCommandString)
@@ -3164,36 +3164,36 @@
aCommandString isNil ifTrue:[^ nil].
(in := anExternalInStream) isNil ifTrue:[
- nullStream := Filename nullDevice readWriteStream.
- in := nullStream.
+ nullStream := Filename nullDevice readWriteStream.
+ in := nullStream.
].
(out := anExternalOutStream) isNil ifTrue:[
- nullStream isNil ifTrue:[nullStream := Filename nullDevice writeStream].
- out := nullStream.
+ nullStream isNil ifTrue:[nullStream := Filename nullDevice writeStream].
+ out := nullStream.
].
(err := anExternalErrStream) isNil ifTrue:[
- err := out
+ err := out
].
anAuxiliaryStream notNil ifTrue:[
- auxFd := anAuxiliaryStream fileDescriptor
+ auxFd := anAuxiliaryStream fileDescriptor
].
shellAndArgs := self commandAndArgsForOSCommand:aCommandString.
rslt := self
- exec:(shellAndArgs at:1)
- withArguments:(shellAndArgs at:2)
- environment:anEvironmentDictionary
- fileDescriptors:(Array with:in fileDescriptor
- with:out fileDescriptor
- with:err fileDescriptor
- with:auxFd)
- fork:true
- newPgrp:true "/ false
- inDirectory:dir.
+ exec:(shellAndArgs at:1)
+ withArguments:(shellAndArgs at:2)
+ environment:anEvironmentDictionary
+ fileDescriptors:(Array with:in fileDescriptor
+ with:out fileDescriptor
+ with:err fileDescriptor
+ with:auxFd)
+ fork:true
+ newPgrp:true "/ false
+ inDirectory:dir.
nullStream notNil ifTrue:[
- nullStream close.
+ nullStream close.
].
^ rslt
@@ -3216,7 +3216,7 @@
The following will no longer work. monitorPid has disappeared
pid notNil ifTrue:[
- Processor monitorPid:pid action:[:OSstatus | sema signal ].
+ Processor monitorPid:pid action:[:OSstatus | sema signal ].
].
in close.
out close.
@@ -3956,16 +3956,16 @@
"return some object filled with info for the file 'aPathName';
the info (for which corresponding access methods are understood by
the returned object) is:
- type - a symbol giving the files type
- mode - numeric access mode
- uid - owners user id
- gid - owners group id
- size - files size
- id - files number (i.e. inode number)
- accessed - last access time (as Timestamp)
- modified - last modification time (as Timestamp)
- statusChanged - last status change time (as Timestamp)
- alternativeName - (windows only:) the MSDOS name of the file
+ type - a symbol giving the files type
+ mode - numeric access mode
+ uid - owners user id
+ gid - owners group id
+ size - files size
+ id - files number (i.e. inode number)
+ accessed - last access time (as Timestamp)
+ modified - last modification time (as Timestamp)
+ statusChanged - last status change time (as Timestamp)
+ alternativeName - (windows only:) the MSDOS name of the file
Some of the fields may be returned as nil on systems which do not provide
all of the information.
@@ -3991,140 +3991,140 @@
unsigned INT ino;
if (__isString(aPathName)) {
- HANDLE hFile;
- FILETIME tempFileTime;
- SYSTEMTIME creationTime;
- SYSTEMTIME accessTime;
- SYSTEMTIME modificationTime;
- int modeBits = 0;
- WIN32_FIND_DATA findStruct;
+ HANDLE hFile;
+ FILETIME tempFileTime;
+ SYSTEMTIME creationTime;
+ SYSTEMTIME accessTime;
+ SYSTEMTIME modificationTime;
+ int modeBits = 0;
+ WIN32_FIND_DATA findStruct;
#ifdef DO_WRAP_CALLS
- {
- char _aPathName[MAXPATHLEN];
-
- strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
- do {
- __threadErrno = 0;
- hFile = STX_API_CALL2( "FindFirstFile", FindFirstFile, _aPathName, &findStruct);
- } while ((hFile < 0) && (__threadErrno == EINTR));
- }
+ {
+ char _aPathName[MAXPATHLEN];
+
+ strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+ do {
+ __threadErrno = 0;
+ hFile = STX_API_CALL2( "FindFirstFile", FindFirstFile, _aPathName, &findStruct);
+ } while ((hFile < 0) && (__threadErrno == EINTR));
+ }
#else
- hFile = FindFirstFile(__stringVal(aPathName), &findStruct);
- if (hFile < 0) {
- __threadErrno = __WIN32_ERR(GetLastError());
- }
-#endif
- if (! hFile || (hFile == (HANDLE)(-1)) || (hFile == INVALID_HANDLE_VALUE)) {
- @global(LastErrorNumber) = __MKSMALLINT(__threadErrno);
- } else {
- FindClose(hFile);
-
- id = __MKSMALLINT(0); /* could get it by opening ... */
- size = __MKLARGEINT64(1, findStruct.nFileSizeLow, findStruct.nFileSizeHigh);
-
- if (findStruct.cFileName[0] != '\0') {
- bcopy(findStruct.cFileName, fileNameBuffer, MAX_PATH);
- fileNameBuffer[MAX_PATH] = '\0';
- fileName = __MKSTRING(fileNameBuffer); /* FULL name */
- }
-
- if (findStruct.cAlternateFileName[0] != '\0') {
- bcopy(findStruct.cAlternateFileName, alternativeFileNameBuffer, 14);
- alternativeFileNameBuffer[14] = '\0';
- alternativeName = __MKSTRING(alternativeFileNameBuffer); /* DOS name */
- }
-
- /*
- * simulate access bits
- */
- if (findStruct.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {
- modeBits = 0444;
- } else {
- modeBits = 0666;
- }
-
- if (findStruct.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
- type = @symbol(directory);
- modeBits |= 0111; /* executable */
- } else {
- type = @symbol(regular);
- }
-
- mode = __MKSMALLINT(modeBits);
-
- /*
- * sigh - convert from stupid time to useful time
- */
- FileTimeToLocalFileTime(&findStruct.ftCreationTime, &tempFileTime);
- FileTimeToSystemTime(&tempFileTime, &creationTime);
- FileTimeToLocalFileTime(&findStruct.ftLastAccessTime, &tempFileTime);
- FileTimeToSystemTime(&tempFileTime, &accessTime);
- FileTimeToLocalFileTime(&findStruct.ftLastWriteTime, &tempFileTime);
- FileTimeToSystemTime(&tempFileTime, &modificationTime);
- aYr = __MKSMALLINT(accessTime.wYear);
- aMon = __MKSMALLINT(accessTime.wMonth);
- aDay = __MKSMALLINT(accessTime.wDay);
- aHr = __MKSMALLINT(accessTime.wHour);
- aMin = __MKSMALLINT(accessTime.wMinute);
- aSec = __MKSMALLINT(accessTime.wSecond);
- aMS = __MKSMALLINT(accessTime.wMilliseconds);
-
- mYr = __MKSMALLINT(modificationTime.wYear);
- mMon = __MKSMALLINT(modificationTime.wMonth);
- mDay = __MKSMALLINT(modificationTime.wDay);
- mHr = __MKSMALLINT(modificationTime.wHour);
- mMin = __MKSMALLINT(modificationTime.wMinute);
- mSec = __MKSMALLINT(modificationTime.wSecond);
- mMS = __MKSMALLINT(modificationTime.wMilliseconds);
-
- cYr = __MKSMALLINT(creationTime.wYear);
- cMon = __MKSMALLINT(creationTime.wMonth);
- cDay = __MKSMALLINT(creationTime.wDay);
- cHr = __MKSMALLINT(creationTime.wHour);
- cMin = __MKSMALLINT(creationTime.wMinute);
- cSec = __MKSMALLINT(creationTime.wSecond);
- cMS = __MKSMALLINT(creationTime.wMilliseconds);
- }
+ hFile = FindFirstFile(__stringVal(aPathName), &findStruct);
+ if (hFile < 0) {
+ __threadErrno = __WIN32_ERR(GetLastError());
+ }
+#endif
+ if (! hFile || (hFile == (HANDLE)(-1)) || (hFile == INVALID_HANDLE_VALUE)) {
+ @global(LastErrorNumber) = __MKSMALLINT(__threadErrno);
+ } else {
+ FindClose(hFile);
+
+ id = __MKSMALLINT(0); /* could get it by opening ... */
+ size = __MKLARGEINT64(1, findStruct.nFileSizeLow, findStruct.nFileSizeHigh);
+
+ if (findStruct.cFileName[0] != '\0') {
+ bcopy(findStruct.cFileName, fileNameBuffer, MAX_PATH);
+ fileNameBuffer[MAX_PATH] = '\0';
+ fileName = __MKSTRING(fileNameBuffer); /* FULL name */
+ }
+
+ if (findStruct.cAlternateFileName[0] != '\0') {
+ bcopy(findStruct.cAlternateFileName, alternativeFileNameBuffer, 14);
+ alternativeFileNameBuffer[14] = '\0';
+ alternativeName = __MKSTRING(alternativeFileNameBuffer); /* DOS name */
+ }
+
+ /*
+ * simulate access bits
+ */
+ if (findStruct.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {
+ modeBits = 0444;
+ } else {
+ modeBits = 0666;
+ }
+
+ if (findStruct.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
+ type = @symbol(directory);
+ modeBits |= 0111; /* executable */
+ } else {
+ type = @symbol(regular);
+ }
+
+ mode = __MKSMALLINT(modeBits);
+
+ /*
+ * sigh - convert from stupid time to useful time
+ */
+ FileTimeToLocalFileTime(&findStruct.ftCreationTime, &tempFileTime);
+ FileTimeToSystemTime(&tempFileTime, &creationTime);
+ FileTimeToLocalFileTime(&findStruct.ftLastAccessTime, &tempFileTime);
+ FileTimeToSystemTime(&tempFileTime, &accessTime);
+ FileTimeToLocalFileTime(&findStruct.ftLastWriteTime, &tempFileTime);
+ FileTimeToSystemTime(&tempFileTime, &modificationTime);
+ aYr = __MKSMALLINT(accessTime.wYear);
+ aMon = __MKSMALLINT(accessTime.wMonth);
+ aDay = __MKSMALLINT(accessTime.wDay);
+ aHr = __MKSMALLINT(accessTime.wHour);
+ aMin = __MKSMALLINT(accessTime.wMinute);
+ aSec = __MKSMALLINT(accessTime.wSecond);
+ aMS = __MKSMALLINT(accessTime.wMilliseconds);
+
+ mYr = __MKSMALLINT(modificationTime.wYear);
+ mMon = __MKSMALLINT(modificationTime.wMonth);
+ mDay = __MKSMALLINT(modificationTime.wDay);
+ mHr = __MKSMALLINT(modificationTime.wHour);
+ mMin = __MKSMALLINT(modificationTime.wMinute);
+ mSec = __MKSMALLINT(modificationTime.wSecond);
+ mMS = __MKSMALLINT(modificationTime.wMilliseconds);
+
+ cYr = __MKSMALLINT(creationTime.wYear);
+ cMon = __MKSMALLINT(creationTime.wMonth);
+ cDay = __MKSMALLINT(creationTime.wDay);
+ cHr = __MKSMALLINT(creationTime.wHour);
+ cMin = __MKSMALLINT(creationTime.wMinute);
+ cSec = __MKSMALLINT(creationTime.wSecond);
+ cMS = __MKSMALLINT(creationTime.wMilliseconds);
+ }
}
%}.
mode isNil ifTrue:[
- (self isDirectory:aPathName) ifTrue:[
- "/ the code above fails for root directories (these do not exist).
- "/ simulate
- mode := 8r777.
- type := #directory.
- uid := gid := 0.
- size := 0.
- id := 0.
- atime := mtime := ctime := Timestamp now.
- ].
+ (self isDirectory:aPathName) ifTrue:[
+ "/ the code above fails for root directories (these do not exist).
+ "/ simulate
+ mode := 8r777.
+ type := #directory.
+ uid := gid := 0.
+ size := 0.
+ id := 0.
+ atime := mtime := ctime := Timestamp now.
+ ].
].
mode notNil ifTrue:[
- atime isNil ifTrue:[
- atime := Timestamp day:aDay month:aMon year:aYr hour:aHr minutes:aMin seconds:aSec milliseconds:aMS.
- ].
- mtime isNil ifTrue:[
- mtime := Timestamp day:mDay month:mMon year:mYr hour:mHr minutes:mMin seconds:mSec milliseconds:mMS.
- ].
- ctime isNil ifTrue:[
- ctime := Timestamp day:cDay month:cMon year:cYr hour:cHr minutes:cMin seconds:cSec milliseconds:cMS.
- ].
-
- info := FileStatusInfo
- type:type
- mode:mode
- uid:uid
- gid:gid
- size:size
- id:id
- accessed:atime
- modified:mtime
- created:ctime
- path:nil
- fullName:fileName
- alternativeName:alternativeName.
- ^ info
+ atime isNil ifTrue:[
+ atime := Timestamp day:aDay month:aMon year:aYr hour:aHr minutes:aMin seconds:aSec milliseconds:aMS.
+ ].
+ mtime isNil ifTrue:[
+ mtime := Timestamp day:mDay month:mMon year:mYr hour:mHr minutes:mMin seconds:mSec milliseconds:mMS.
+ ].
+ ctime isNil ifTrue:[
+ ctime := Timestamp day:cDay month:cMon year:cYr hour:cHr minutes:cMin seconds:cSec milliseconds:cMS.
+ ].
+
+ info := FileStatusInfo
+ type:type
+ mode:mode
+ uid:uid
+ gid:gid
+ size:size
+ id:id
+ accessed:atime
+ modified:mtime
+ created:ctime
+ path:nil
+ fullName:fileName
+ alternativeName:alternativeName.
+ ^ info
].
^ nil
@@ -5570,8 +5570,8 @@
getNetworkMACAddresses
"return a dictionary filled with
- key -> name of interface
- value -> the MAC adress (as ByteArray)
+ key -> name of interface
+ value -> the MAC adress (as ByteArray)
for each interface
"
@@ -5593,22 +5593,22 @@
DWORD dwStatus;
dwStatus = GetAdaptersInfo(
- AdapterInfo, // [out] buffer to receive data
- &dwBufLen); // [in] size of receive data buffer
+ AdapterInfo, // [out] buffer to receive data
+ &dwBufLen); // [in] size of receive data buffer
if (dwStatus == ERROR_SUCCESS) {
- PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo;
- unsigned char *bP;
- int nA = 0;
-
- bP = __byteArrayVal(rawData);
- do {
- name = __MKSTRING(pAdapterInfo->AdapterName);
- description = __MKSTRING(pAdapterInfo->Description);
- macAddress = __MKBYTEARRAY(pAdapterInfo->Address, 6);
- ipAddress = __MKSTRING(pAdapterInfo->IpAddressList.IpAddress.String);
- ipAddressMask = __MKSTRING(pAdapterInfo->IpAddressList.IpMask.String);
- entry = __ARRAY_NEW_INT(5);
+ PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo;
+ unsigned char *bP;
+ int nA = 0;
+
+ bP = __byteArrayVal(rawData);
+ do {
+ name = __MKSTRING(pAdapterInfo->AdapterName);
+ description = __MKSTRING(pAdapterInfo->Description);
+ macAddress = __MKBYTEARRAY(pAdapterInfo->Address, 6);
+ ipAddress = __MKSTRING(pAdapterInfo->IpAddressList.IpAddress.String);
+ ipAddressMask = __MKSTRING(pAdapterInfo->IpAddressList.IpMask.String);
+ entry = __ARRAY_NEW_INT(5);
/*
* back to ST/X's String definition
*/
@@ -5618,31 +5618,29 @@
#ifdef __DEF_String
# define Context __DEF_Context
#endif
- __ArrayInstPtr(entry)->a_element[0] = name; __STORE(entry, name);
- __ArrayInstPtr(entry)->a_element[1] = description; __STORE(entry, description);
- __ArrayInstPtr(entry)->a_element[2] = macAddress; __STORE(entry, macAddress);
- __ArrayInstPtr(entry)->a_element[3] = ipAddress; __STORE(entry, ipAddress);
- __ArrayInstPtr(entry)->a_element[4] = ipAddressMask; __STORE(entry, ipAddressMask);
-
- __ArrayInstPtr(rawData)->a_element[nA] = entry; __STORE(rawData, entry);
- nA++;
- pAdapterInfo = pAdapterInfo->Next;
- } while(pAdapterInfo);
- nAdapters = __mkSmallInteger(nA);
+ __ArrayInstPtr(entry)->a_element[0] = name; __STORE(entry, name);
+ __ArrayInstPtr(entry)->a_element[1] = description; __STORE(entry, description);
+ __ArrayInstPtr(entry)->a_element[2] = macAddress; __STORE(entry, macAddress);
+ __ArrayInstPtr(entry)->a_element[3] = ipAddress; __STORE(entry, ipAddress);
+ __ArrayInstPtr(entry)->a_element[4] = ipAddressMask; __STORE(entry, ipAddressMask);
+
+ __ArrayInstPtr(rawData)->a_element[nA] = entry; __STORE(rawData, entry);
+ nA++;
+ pAdapterInfo = pAdapterInfo->Next;
+ } while(pAdapterInfo);
+ nAdapters = __mkSmallInteger(nA);
}
%}.
- nAdapters isNil ifTrue:[
- self primitiveFailed.
- ].
-
info := Dictionary new.
- 1 to:nAdapters do:[:i |
- |entry name macAddr|
-
- entry := rawData at:i.
- name := entry at:1.
- macAddr := entry at:3.
- info at:name put:macAddr.
+ nAdapters notNil ifTrue:[
+ 1 to:nAdapters do:[:i |
+ |entry name macAddr|
+
+ entry := rawData at:i.
+ name := entry at:1.
+ macAddr := entry at:3.
+ info at:name put:macAddr.
+ ].
].
^ info
@@ -5716,25 +5714,25 @@
This method is mainly provided to augment error reports with some system
information.
(in case of system/version specific OS errors, conditional workarounds and patches
- may be based upon this info).
+ may be based upon this info).
Your application should NOT depend upon this in any way.
The returned info may (or may not) contain:
- #system -> some operating system identification (irix, Linux, nt, win32s ...)
- #version -> OS version (some os version identification)
- #release -> OS release (3.5, 1.2.1 ...)
- #node -> some host identification (hostname)
- #domain -> domain name (hosts domain)
- #machine -> type of machine (i586, mips ...)
+ #system -> some operating system identification (irix, Linux, nt, win32s ...)
+ #version -> OS version (some os version identification)
+ #release -> OS release (3.5, 1.2.1 ...)
+ #node -> some host identification (hostname)
+ #domain -> domain name (hosts domain)
+ #machine -> type of machine (i586, mips ...)
win32:
- #physicalRam -> total amount of physical memory
- #freeRam -> amount of free memory
- #swapSize -> size of swapSpace (page file)
- #freeSwap -> free bytes in swapSpace
- #virtualRam -> total amount of virtual memory
- #freeVirtual -> amount of free virtual memory
- #memoryLoad -> percentage of memory usage (useless)
+ #physicalRam -> total amount of physical memory
+ #freeRam -> amount of free memory
+ #swapSize -> size of swapSpace (page file)
+ #freeSwap -> free bytes in swapSpace
+ #virtualRam -> total amount of virtual memory
+ #freeVirtual -> amount of free virtual memory
+ #memoryLoad -> percentage of memory usage (useless)
"
|sys node rel ver mach dom info arch
@@ -5757,14 +5755,14 @@
verMajor = LOBYTE(winVer);
if (HIWORD(vsn) & 0x8000) {
- s = "win95";
+ s = "win95";
} else {
- if ((verMajor > 5)
- || ((verMajor == 5) && (verMinor >= 1))) {
- s = "xp";
- } else {
- s = "nt";
- }
+ if ((verMajor > 5)
+ || ((verMajor == 5) && (verMinor >= 1))) {
+ s = "xp";
+ } else {
+ s = "nt";
+ }
}
sys = __MKSTRING(s);
len = snprintf(vsnBuffer, sizeof(vsnBuffer), "%d.%d", verMajor, verMinor);
@@ -5791,105 +5789,105 @@
#endif
{
#ifdef PROCESSOR_ARCHITECTURE_INTEL
- case PROCESSOR_ARCHITECTURE_INTEL:
- s = "intel";
- break;
+ case PROCESSOR_ARCHITECTURE_INTEL:
+ s = "intel";
+ break;
#endif
#ifdef PROCESSOR_ARCHITECTURE_MIPS
- case PROCESSOR_ARCHITECTURE_MIPS:
- s = "mips";
- break;
+ case PROCESSOR_ARCHITECTURE_MIPS:
+ s = "mips";
+ break;
#endif
#ifdef PROCESSOR_ARCHITECTURE_ALPHA
- case PROCESSOR_ARCHITECTURE_ALPHA:
- s = "alpha";
- break;
+ case PROCESSOR_ARCHITECTURE_ALPHA:
+ s = "alpha";
+ break;
#endif
#ifdef PROCESSOR_ARCHITECTURE_PPC
- case PROCESSOR_ARCHITECTURE_PPC:
- s = "ppc";
- break;
+ case PROCESSOR_ARCHITECTURE_PPC:
+ s = "ppc";
+ break;
#endif
#ifdef PROCESSOR_ARCHITECTURE_ARM
- case PROCESSOR_ARCHITECTURE_ARM:
- s = "arm";
- break;
-#endif
- default:
- s = "unknown";
- break;
+ case PROCESSOR_ARCHITECTURE_ARM:
+ s = "arm";
+ break;
+#endif
+ default:
+ s = "unknown";
+ break;
}
arch = __MKSTRING(s);
switch (sysInfo.dwProcessorType) {
#ifdef PROCESSOR_INTEL_386
- case PROCESSOR_INTEL_386:
- s = "i386";
- break;
+ case PROCESSOR_INTEL_386:
+ s = "i386";
+ break;
#endif
#ifdef PROCESSOR_INTEL_486
- case PROCESSOR_INTEL_486:
- s = "i486";
- break;
+ case PROCESSOR_INTEL_486:
+ s = "i486";
+ break;
#endif
#ifdef PROCESSOR_INTEL_PENTIUM
- case PROCESSOR_INTEL_PENTIUM:
- s = "i586";
- break;
+ case PROCESSOR_INTEL_PENTIUM:
+ s = "i586";
+ break;
#endif
#ifdef PROCESSOR_INTEL_860
- case PROCESSOR_INTEL_860:
- s = "i860";
- break;
+ case PROCESSOR_INTEL_860:
+ s = "i860";
+ break;
#endif
#ifdef PROCESSOR_MIPS_R2000
- case PROCESSOR_MIPS_R2000:
- s = "r2000";
- break;
+ case PROCESSOR_MIPS_R2000:
+ s = "r2000";
+ break;
#endif
#ifdef PROCESSOR_MIPS_R3000
- case PROCESSOR_MIPS_R3000:
- s = "r3000";
- break;
+ case PROCESSOR_MIPS_R3000:
+ s = "r3000";
+ break;
#endif
#ifdef PROCESSOR_MIPS_R4000
- case PROCESSOR_MIPS_R4000:
- s = "r4000";
- break;
+ case PROCESSOR_MIPS_R4000:
+ s = "r4000";
+ break;
#endif
#ifdef PROCESSOR_ALPHA_21064
- case PROCESSOR_ALPHA_21064:
- s = "alpha21064";
- break;
+ case PROCESSOR_ALPHA_21064:
+ s = "alpha21064";
+ break;
#endif
#ifdef PROCESSOR_ARM_7TDMI
- case PROCESSOR_ARM_7TDMI:
- s = "arm70001";
- break;
-#endif
- default:
- sprintf(vsnBuffer, "%d", sysInfo.dwProcessorType);
- s = vsnBuffer;
- break;
+ case PROCESSOR_ARM_7TDMI:
+ s = "arm70001";
+ break;
+#endif
+ default:
+ sprintf(vsnBuffer, "%d", sysInfo.dwProcessorType);
+ s = vsnBuffer;
+ break;
}
mach = __MKSTRING(s);
numberOfCPUs = __MKUINT(sysInfo.dwNumberOfProcessors);
%}.
sys isNil ifTrue:[
- sys := self getSystemType.
+ sys := self getSystemType.
].
node isNil ifTrue:[
- node := self getHostName.
+ node := self getHostName.
].
dom isNil ifTrue:[
- dom := self getDomainName.
+ dom := self getDomainName.
].
mach isNil ifTrue:[
- mach := self getCPUType.
+ mach := self getCPUType.
].
arch isNil ifTrue:[
- arch := 'unknown'.
+ arch := 'unknown'.
].
info := IdentityDictionary new.
@@ -6572,33 +6570,33 @@
if (__bothSmallInteger(y, m)
&& __bothSmallInteger(d, h)
&& __bothSmallInteger(min, s)) {
- TIME_T t;
- int utcOffset;
-
- tm.tm_hour = __intVal(h);
- tm.tm_min = __intVal(min);
- tm.tm_sec = __intVal(s);
-
- tm.tm_year = __intVal(y) - 1900;
- tm.tm_mon = __intVal(m) - 1;
- tm.tm_mday = __intVal(d);
- tm.tm_isdst = -1;
-
- if (tm.tm_isdst == 0) {
- utcOffset = __MKINT(TIMEZONE(tmPtr));
- } else {
+ TIME_T t;
+ int utcOffset;
+
+ tm.tm_hour = __intVal(h);
+ tm.tm_min = __intVal(min);
+ tm.tm_sec = __intVal(s);
+
+ tm.tm_year = __intVal(y) - 1900;
+ tm.tm_mon = __intVal(m) - 1;
+ tm.tm_mday = __intVal(d);
+ tm.tm_isdst = -1;
+
+ if (tm.tm_isdst == 0) {
+ utcOffset = __MKINT(TIMEZONE(tmPtr));
+ } else {
#ifdef HAS_ALTZONE
- utcOffset = __MKINT(altzone);
+ utcOffset = __MKINT(altzone);
#else
- utcOffset = __MKINT(TIMEZONE(tmPtr) + 3600);
-#endif
- }
- t = mktime(&tm);
- osSeconds = __MKUINT((INT)t);
+ utcOffset = __MKINT(TIMEZONE(tmPtr) + 3600);
+#endif
+ }
+ t = mktime(&tm);
+ osSeconds = __MKUINT((INT)t);
}
%}.
osSeconds notNil ifTrue:[
- ^ osSeconds * 1000 + millis
+ ^ osSeconds * 1000 + millis
].
^ self primitiveFailed
@@ -7100,23 +7098,23 @@
dir := self getEnvironment:'HOME'.
dir isNil ifTrue:[
- "for NT/WIN2K/XP users:
- if HOME is nil, try first HOMEHSARE and then HOMEDRIVE and HOMEPATH"
-
- dir := self getEnvironment:'HOMESHARE'.
- dir isNil ifTrue:[
- ((drv := self getEnvironment:'HOMEDRIVE') notNil
- and:[(path := self getEnvironment:'HOMEPATH') notNil]) ifTrue:[
- dir := drv , path
- ] ifFalse:[
- dir := '.'.
- ].
- ].
+ "for NT/WIN2K/XP users:
+ if HOME is nil, try first HOMEHSARE and then HOMEDRIVE and HOMEPATH"
+
+ dir := self getEnvironment:'HOMESHARE'.
+ dir isNil ifTrue:[
+ ((drv := self getEnvironment:'HOMEDRIVE') notNil
+ and:[(path := self getEnvironment:'HOMEPATH') notNil]) ifTrue:[
+ dir := drv , path
+ ] ifFalse:[
+ dir := '.'.
+ ].
+ ].
].
^ dir
"
- OperatingSystem getHomeDirectory
+ OperatingSystem getHomeDirectory
"
"Modified: / 16.2.2000 / 09:17:55 / cg"
@@ -8133,139 +8131,139 @@
examples
"
retrieve an existing entry by key:
- [exBegin]
- |k|
-
- k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'
+ [exEnd]
retrieve a non-existing entry by key:
- [exBegin]
- |k|
-
- k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software\xxx'
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software\xxx'
+ [exEnd]
ask a keys value:
- [exBegin]
- |k|
-
- k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion'.
- Transcript show:'Windows serial NR:'; showCR:(k valueNamed:'ProductId').
-
- k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
- Transcript showCR:(k valueNamed:'CurrentVersion').
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion'.
+ Transcript show:'Windows serial NR:'; showCR:(k valueNamed:'ProductId').
+
+ k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
+ Transcript showCR:(k valueNamed:'CurrentVersion').
+ [exEnd]
create a sub-key (if not already present):
- [exBegin]
- |k subKey|
-
- k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
- subKey := k createSubKeyNamed:'RegistryDemo'
- [exEnd]
+ [exBegin]
+ |k subKey|
+
+ k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
+ subKey := k createSubKeyNamed:'RegistryDemo'
+ [exEnd]
change a keys value:
- [exBegin]
- |k|
-
- k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\RegistryDemo'.
- k valueNamed:'FooBarBaz' put:'a foo bar baz string'.
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\RegistryDemo'.
+ k valueNamed:'FooBarBaz' put:'a foo bar baz string'.
+ [exEnd]
delete a value:
- [exBegin]
- |k|
-
- k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\RegistryDemo'.
- k deleteValueNamed:'FooBarBaz'.
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\RegistryDemo'.
+ k deleteValueNamed:'FooBarBaz'.
+ [exEnd]
delete a key:
- [exBegin]
- |k|
-
- k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
- k deleteSubKeyNamed:'RegistryDemo'.
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
+ k deleteSubKeyNamed:'RegistryDemo'.
+ [exEnd]
enumerate keys:
- [exBegin]
- |k|
-
- k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software'.
- k subKeysDo:[:subKey |
- Transcript showCR:subKey path
- ]
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software'.
+ k subKeysDo:[:subKey |
+ Transcript showCR:subKey path
+ ]
+ [exEnd]
enumerate all keys (recursive):
- [exBegin]
- |k|
-
- k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software'.
- k allSubKeysDo:[:subKey |
- Transcript showCR:subKey path
- ]
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software'.
+ k allSubKeysDo:[:subKey |
+ Transcript showCR:subKey path
+ ]
+ [exEnd]
fetch value by index:
- [exBegin]
- |k|
-
- k := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
- Transcript showCR:(k valueNameAtIndex:0)
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
+ Transcript showCR:(k valueNameAtIndex:0)
+ [exEnd]
enumerate value names:
- [exBegin]
- |k|
-
- k := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
- k valueNamesDo:[:nm |
- Transcript showCR:nm.
- ]
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
+ k valueNamesDo:[:nm |
+ Transcript showCR:nm.
+ ]
+ [exEnd]
enumerate values:
- [exBegin]
- |k|
-
- k := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
- k valueNamesAndValuesDo:[:nm :val |
- Transcript showCR:(nm , ' -> ' , val storeString).
- ]
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
+ k valueNamesAndValuesDo:[:nm :val |
+ Transcript showCR:(nm , ' -> ' , val storeString).
+ ]
+ [exEnd]
search for a value (where does NT store the domain ?):
- [exBegin]
- |k|
-
- k := self key:'HKEY_LOCAL_MACHINE\System'.
- k subKeysDo:[:subKey |
- subKey subKeysDo:[:subSubKey |
- |tcp params|
-
- (subSubKey path asLowercase endsWith:'services') ifTrue:[
- tcp := subSubKey subKeyNamed:'tcpip'.
- tcp notNil ifTrue:[
- params := tcp subKeyNamed:'parameters'.
- params notNil ifTrue:[
- Transcript showCR:'Domain is found in ' , params path ,
- ' value: ' , (params valueNamed:'Domain').
- params close.
- ].
- tcp close.
- ]
- ]
- ]
- ]
- [exEnd]
+ [exBegin]
+ |k|
+
+ k := self key:'HKEY_LOCAL_MACHINE\System'.
+ k subKeysDo:[:subKey |
+ subKey subKeysDo:[:subSubKey |
+ |tcp params|
+
+ (subSubKey path asLowercase endsWith:'services') ifTrue:[
+ tcp := subSubKey subKeyNamed:'tcpip'.
+ tcp notNil ifTrue:[
+ params := tcp subKeyNamed:'parameters'.
+ params notNil ifTrue:[
+ Transcript showCR:'Domain is found in ' , params path ,
+ ' value: ' , (params valueNamed:'Domain').
+ params close.
+ ].
+ tcp close.
+ ]
+ ]
+ ]
+ ]
+ [exEnd]
"
@@ -8286,7 +8284,7 @@
HKEY_DYN_DATA := %{ __MKEXTERNALADDRESS(HKEY_DYN_DATA) %}.
"
- self initialize
+ self initialize
"
"Created: / 19.5.1999 / 21:39:57 / cg"
@@ -8297,25 +8295,25 @@
HKEY_CLASSES_ROOT isNil ifTrue:[self initialize].
specialKeyStringOrSymbol = #'HKEY_CLASSES_ROOT' ifTrue:[
- ^ HKEY_CLASSES_ROOT.
+ ^ HKEY_CLASSES_ROOT.
].
specialKeyStringOrSymbol = #'HKEY_CURRENT_USER' ifTrue:[
- ^ HKEY_CURRENT_USER.
+ ^ HKEY_CURRENT_USER.
].
specialKeyStringOrSymbol = #'HKEY_LOCAL_MACHINE' ifTrue:[
- ^ HKEY_LOCAL_MACHINE.
+ ^ HKEY_LOCAL_MACHINE.
].
specialKeyStringOrSymbol = #'HKEY_USERS' ifTrue:[
- ^ HKEY_USERS.
+ ^ HKEY_USERS.
].
specialKeyStringOrSymbol = #'HKEY_PERFORMANCE_DATA' ifTrue:[
- ^ HKEY_PERFORMANCE_DATA.
+ ^ HKEY_PERFORMANCE_DATA.
].
specialKeyStringOrSymbol = #'HKEY_CURRENT_CONFIG' ifTrue:[
- ^ HKEY_CURRENT_CONFIG.
+ ^ HKEY_CURRENT_CONFIG.
].
specialKeyStringOrSymbol = #'HKEY_DYN_DATA' ifTrue:[
- ^ HKEY_DYN_DATA.
+ ^ HKEY_DYN_DATA.
].
^ nil
@@ -8328,7 +8326,7 @@
"handle image restarts and refetch registry handles"
(something == #returnFromSnapshot) ifTrue:[
- self initialize
+ self initialize
]
"Created: 15.6.1996 / 15:14:03 / cg"
@@ -9125,7 +9123,7 @@
!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.161 2004-11-16 22:52:51 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.162 2004-11-17 01:20:38 cg Exp $'
! !
!Win32OperatingSystem::Win32FILEHandle methodsFor:'release'!
@@ -9152,7 +9150,7 @@
!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.161 2004-11-16 22:52:51 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.162 2004-11-17 01:20:38 cg Exp $'
! !
!Win32OperatingSystem::Win32Handle methodsFor:'io'!
@@ -9531,7 +9529,7 @@
!Win32OperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.161 2004-11-16 22:52:51 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.162 2004-11-17 01:20:38 cg Exp $'
! !
Win32OperatingSystem initialize!