--- a/Win32OperatingSystem.st Fri Apr 26 18:03:27 2013 +0100
+++ b/Win32OperatingSystem.st Mon Apr 29 19:43:44 2013 +0100
@@ -747,14 +747,14 @@
HRESULT hres;
if( ! coInitialized ) {
- hres = CoInitializeEx(NULL, COINIT_MULTITHREADED);
- if (! SUCCEEDED(hres)) {
- console_fprintf(stderr, "OperatingSystem [info]: Could not open the COM library hres = %08x\n", hres );
- goto error;
- }
- coInitialized = 1;
+ hres = CoInitializeEx(NULL, COINIT_MULTITHREADED);
+ if (! SUCCEEDED(hres)) {
+ console_fprintf(stderr, "OperatingSystem [info]: Could not open the COM library hres = %08x\n", hres );
+ goto error;
+ }
+ coInitialized = 1;
#ifdef COM_DEBUG
- console_fprintf(stderr, "OperatingSystem [info]: COM initialized\n" );
+ console_fprintf(stderr, "OperatingSystem [info]: COM initialized\n" );
#endif
}
RETURN (self );
@@ -5744,20 +5744,20 @@
path := self primPathNameOf:pathName.
path isNil ifTrue:[
- (self isValidPath:pathName) ifFalse:[
- p := pathName.
- [(p size > 1)
- and:[p endsWith:(self fileSeparator)]
- ] whileTrue:[
- p := p copyButLast:1.
- ].
- ^ p
- ].
-
- "/
- "/ return the original - there is nothing else can we do
- "/
- path := self compressPath:pathName
+ (self isValidPath:pathName) ifFalse:[
+ p := pathName.
+ [(p size > 1)
+ and:[p endsWith:(self fileSeparator)]
+ ] whileTrue:[
+ p := p copyButLast:1.
+ ].
+ ^ p
+ ].
+
+ "/
+ "/ return the original - there is nothing else can we do
+ "/
+ path := self compressPath:pathName
].
^ path.
@@ -5862,86 +5862,86 @@
%{
if (__isStringLike(aPathName)) {
- char nameBuffer[MAXPATHLEN + 1];
- char nameBuffer2[MAXPATHLEN + 1];
- char *returnedName = NULL;
- int rslt;
+ char nameBuffer[MAXPATHLEN + 1];
+ char nameBuffer2[MAXPATHLEN + 1];
+ char *returnedName = NULL;
+ int rslt;
#ifdef DO_WRAP_CALLS
- char _aPathName[MAXPATHLEN+1];
-
- strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
- do {
- __threadErrno = 0;
- rslt = STX_API_NOINT_CALL4( "GetFullPathNameA", GetFullPathNameA, _aPathName, MAXPATHLEN, nameBuffer, NULL);
- } while ((rslt < 0) && (__threadErrno == EINTR));
-#else
- rslt = GetFullPathNameA(__stringVal(aPathName), MAXPATHLEN, nameBuffer, NULL);
-#endif
- returnedName = nameBuffer;
-
- if (rslt > 0) {
+ char _aPathName[MAXPATHLEN+1];
+
+ strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+ do {
+ __threadErrno = 0;
+ rslt = STX_API_NOINT_CALL4( "GetFullPathNameA", GetFullPathNameA, _aPathName, MAXPATHLEN, nameBuffer, NULL);
+ } while ((rslt < 0) && (__threadErrno == EINTR));
+#else
+ rslt = GetFullPathNameA(__stringVal(aPathName), MAXPATHLEN, nameBuffer, NULL);
+#endif
+ returnedName = nameBuffer;
+
+ if (rslt > 0) {
#ifdef DO_WRAP_CALLS
- do {
- __threadErrno = 0;
- rslt = STX_API_NOINT_CALL3( "GetLongPathNameA", GetLongPathNameA, nameBuffer, nameBuffer2, MAXPATHLEN);
- } while ((rslt < 0) && (__threadErrno == EINTR));
-#else
- rslt = GetLongPathNameA(nameBuffer, nameBuffer2, MAXPATHLEN);
-#endif
- returnedName = nameBuffer2;
- }
- if (rslt > 0) {
- RETURN ( __MKSTRING(returnedName) );
- }
- __threadErrno = __WIN32_ERR(GetLastError());
- RETURN (nil);
+ do {
+ __threadErrno = 0;
+ rslt = STX_API_NOINT_CALL3( "GetLongPathNameA", GetLongPathNameA, nameBuffer, nameBuffer2, MAXPATHLEN);
+ } while ((rslt < 0) && (__threadErrno == EINTR));
+#else
+ rslt = GetLongPathNameA(nameBuffer, nameBuffer2, MAXPATHLEN);
+#endif
+ returnedName = nameBuffer2;
+ }
+ if (rslt > 0) {
+ RETURN ( __MKSTRING(returnedName) );
+ }
+ __threadErrno = __WIN32_ERR(GetLastError());
+ RETURN (nil);
}
if (__isUnicode16String(aPathName)) {
- wchar_t nameBuffer[MAXPATHLEN + 1];
- wchar_t nameBuffer2[MAXPATHLEN + 1];
- wchar_t *returnedName = NULL;
- int rslt;
- wchar_t _aPathName[MAXPATHLEN+1];
- int i, l;
-
- l = __unicode16StringSize(aPathName);
- if (l > MAXPATHLEN) l = MAXPATHLEN;
- for (i=0; i<l; i++) {
- _aPathName[i] = __unicode16StringVal(aPathName)[i];
- }
- _aPathName[i] = 0;
+ wchar_t nameBuffer[MAXPATHLEN + 1];
+ wchar_t nameBuffer2[MAXPATHLEN + 1];
+ wchar_t *returnedName = NULL;
+ int rslt;
+ wchar_t _aPathName[MAXPATHLEN+1];
+ int i, l;
+
+ l = __unicode16StringSize(aPathName);
+ if (l > MAXPATHLEN) l = MAXPATHLEN;
+ for (i=0; i<l; i++) {
+ _aPathName[i] = __unicode16StringVal(aPathName)[i];
+ }
+ _aPathName[i] = 0;
#ifdef DO_WRAP_CALLS
- do {
- __threadErrno = 0;
- rslt = STX_API_NOINT_CALL4( "GetFullPathNameW", GetFullPathNameW, _aPathName, MAXPATHLEN, nameBuffer, NULL);
- } while ((rslt < 0) && (__threadErrno == EINTR));
-#else
- rslt = GetFullPathNameW(_aPathName, MAXPATHLEN, nameBuffer, NULL);
-#endif
- returnedName = nameBuffer;
-
- if (rslt > 0) {
+ do {
+ __threadErrno = 0;
+ rslt = STX_API_NOINT_CALL4( "GetFullPathNameW", GetFullPathNameW, _aPathName, MAXPATHLEN, nameBuffer, NULL);
+ } while ((rslt < 0) && (__threadErrno == EINTR));
+#else
+ rslt = GetFullPathNameW(_aPathName, MAXPATHLEN, nameBuffer, NULL);
+#endif
+ returnedName = nameBuffer;
+
+ if (rslt > 0) {
#ifdef DO_WRAP_CALLS
- do {
- __threadErrno = 0;
- rslt = STX_API_NOINT_CALL3( "GetLongPathNameW", GetLongPathNameW, nameBuffer, nameBuffer2, MAXPATHLEN);
- } while ((rslt < 0) && (__threadErrno == EINTR));
-#else
- rslt = GetLongPathNameW(nameBuffer, nameBuffer2, MAXPATHLEN);
-#endif
- returnedName = nameBuffer2;
- }
- if (rslt > 0) {
- RETURN ( __MKU16STRING(returnedName) );
- }
- __threadErrno = __WIN32_ERR(GetLastError());
+ do {
+ __threadErrno = 0;
+ rslt = STX_API_NOINT_CALL3( "GetLongPathNameW", GetLongPathNameW, nameBuffer, nameBuffer2, MAXPATHLEN);
+ } while ((rslt < 0) && (__threadErrno == EINTR));
+#else
+ rslt = GetLongPathNameW(nameBuffer, nameBuffer2, MAXPATHLEN);
+#endif
+ returnedName = nameBuffer2;
+ }
+ if (rslt > 0) {
+ RETURN ( __MKU16STRING(returnedName) );
+ }
+ __threadErrno = __WIN32_ERR(GetLastError());
}
error = @symbol(argument); // argument is not a string or unicode16string
%}.
error notNil ifTrue:[
- self primitiveFailed:error.
+ self primitiveFailed:error.
].
^ nil
@@ -7776,8 +7776,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
"
@@ -7798,21 +7798,21 @@
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
*/
@@ -7822,32 +7822,32 @@
# 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);
}
%}.
"Keep the order as reurned by the OS"
info := OrderedDictionary new:nAdapters.
nAdapters notNil ifTrue:[
- 1 to:nAdapters do:[:i |
- |entry name description macAddr ipAddr|
-
- entry := rawData at:i.
- name := entry at:1.
- "/ description := entry at:2.
- macAddr := entry at:3.
- "/ ipAddr := entry at:4.
- info at:name put:macAddr.
- ].
+ 1 to:nAdapters do:[:i |
+ |entry name description macAddr ipAddr|
+
+ entry := rawData at:i.
+ name := entry at:1.
+ "/ description := entry at:2.
+ macAddr := entry at:3.
+ "/ ipAddr := entry at:4.
+ info at:name put:macAddr.
+ ].
].
^ info
@@ -12195,157 +12195,157 @@
//iterate all following objetcs
for (objectIterator=0; objectIterator<numObjectTypes; objectIterator++) {
- //add the st_perObject dictionary to st_objectArray
- st_perObject = __SSEND0(@global(Dictionary), @symbol(new), 0);
- __AT_PUT_(st_objectArray, __mkSmallInteger(objectIterator+1), st_perObject);
-
- //get the object data
- __AT_PUT_(st_perObject, @symbol(ObjectNameTitleIndex), __mkSmallInteger(perfObjectPtr->ObjectNameTitleIndex));
- __AT_PUT_(st_perObject, @symbol(DetailLevel), __mkSmallInteger(perfObjectPtr->DetailLevel));
- __AT_PUT_(st_perObject, @symbol(NumCounters), __mkSmallInteger(perfObjectPtr->NumCounters));
- __AT_PUT_(st_perObject, @symbol(NumInstances), __mkSmallInteger(perfObjectPtr->NumInstances));
-
- //setup counter array and initialize its pointer
- st_counterArray = __ARRAY_NEW_INT(perfObjectPtr->NumCounters);
- perfCounterPtr = (PERF_COUNTER_DEFINITION *)((char *)perfObjectPtr + perfObjectPtr->HeaderLength);
-
- //add the st_counterArray to st_perObject dictionary
- __AT_PUT_(st_perObject, @symbol(Counters), st_counterArray);
-
- //iterate all following counter definition
- for (counterIterator=0; counterIterator<perfObjectPtr->NumCounters; counterIterator++) {
- //add the st_perCounter dictionary to st_counterArray
- st_perCounter = __SSEND0(@global(Dictionary), @symbol(new), 0);
- __AT_PUT_(st_counterArray, __mkSmallInteger(counterIterator+1), st_perCounter);
-
- //get the counter data
- __AT_PUT_(st_perCounter, @symbol(CounterNameTitleIndex), __mkSmallInteger(perfCounterPtr->CounterNameTitleIndex));
- __AT_PUT_(st_perCounter, @symbol(CounterTypeBits), __mkSmallInteger(perfCounterPtr->CounterType));
- __AT_PUT_(st_perCounter, @symbol(CounterSize), __mkSmallInteger(perfCounterPtr->CounterSize));
- __AT_PUT_(st_perCounter, @symbol(CounterOffset), __mkSmallInteger(perfCounterPtr->CounterOffset));
-
- //put the counter type size
- switch (perfCounterPtr->CounterType & PERF_SIZE_MASK) {
- case PERF_SIZE_DWORD:
- __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(DWORD));
- break;
- case PERF_SIZE_LARGE:
- __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(LARGE));
- break;
- case PERF_SIZE_ZERO:
- __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(ZERO));
- break;
- case PERF_SIZE_VARIABLE_LEN:
- __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(VARIABLE_LEN));
- break;
- }
- switch (perfCounterPtr->CounterType & PERF_TYPE_MASK) {
- case PERF_TYPE_NUMBER:
- __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(NUMBER));
- switch (perfCounterPtr->CounterType & PERF_NUMBERTYPE_MASK) {
- case PERF_NUMBER_HEX:
- __AT_PUT_(st_perCounter, @symbol(NUMBER),@symbol(HEX));
- break;
- case PERF_NUMBER_DECIMAL:
- __AT_PUT_(st_perCounter, @symbol(NUMBER),@symbol(DECIMAL));
- break;
- case PERF_NUMBER_DEC_1000:
- __AT_PUT_(st_perCounter, @symbol(NUMBER),@symbol(DEC_1000));
- break;
- }
- break;
- case PERF_TYPE_COUNTER:
- __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(COUNTER));
- switch (perfCounterPtr->CounterType & PERF_COUNTERTYPE_MASK) {
- case PERF_COUNTER_VALUE:
- __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(VALUE));
- break;
- case PERF_COUNTER_RATE:
- __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(RATE));
- break;
- case PERF_COUNTER_FRACTION:
- __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(FRACTION));
- break;
- case PERF_COUNTER_BASE:
- __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(BASE));
- break;
- case PERF_COUNTER_ELAPSED:
- __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(ELAPSED));
- break;
- case PERF_COUNTER_QUEUELEN:
- __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(QUEUELEN));
- break;
- case PERF_COUNTER_HISTOGRAM:
- __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(HISTOGRAM));
- break;
+ //add the st_perObject dictionary to st_objectArray
+ st_perObject = __SSEND0(@global(Dictionary), @symbol(new), 0);
+ __AT_PUT_(st_objectArray, __mkSmallInteger(objectIterator+1), st_perObject);
+
+ //get the object data
+ __AT_PUT_(st_perObject, @symbol(ObjectNameTitleIndex), __mkSmallInteger(perfObjectPtr->ObjectNameTitleIndex));
+ __AT_PUT_(st_perObject, @symbol(DetailLevel), __mkSmallInteger(perfObjectPtr->DetailLevel));
+ __AT_PUT_(st_perObject, @symbol(NumCounters), __mkSmallInteger(perfObjectPtr->NumCounters));
+ __AT_PUT_(st_perObject, @symbol(NumInstances), __mkSmallInteger(perfObjectPtr->NumInstances));
+
+ //setup counter array and initialize its pointer
+ st_counterArray = __ARRAY_NEW_INT(perfObjectPtr->NumCounters);
+ perfCounterPtr = (PERF_COUNTER_DEFINITION *)((char *)perfObjectPtr + perfObjectPtr->HeaderLength);
+
+ //add the st_counterArray to st_perObject dictionary
+ __AT_PUT_(st_perObject, @symbol(Counters), st_counterArray);
+
+ //iterate all following counter definition
+ for (counterIterator=0; counterIterator<perfObjectPtr->NumCounters; counterIterator++) {
+ //add the st_perCounter dictionary to st_counterArray
+ st_perCounter = __SSEND0(@global(Dictionary), @symbol(new), 0);
+ __AT_PUT_(st_counterArray, __mkSmallInteger(counterIterator+1), st_perCounter);
+
+ //get the counter data
+ __AT_PUT_(st_perCounter, @symbol(CounterNameTitleIndex), __mkSmallInteger(perfCounterPtr->CounterNameTitleIndex));
+ __AT_PUT_(st_perCounter, @symbol(CounterTypeBits), __mkSmallInteger(perfCounterPtr->CounterType));
+ __AT_PUT_(st_perCounter, @symbol(CounterSize), __mkSmallInteger(perfCounterPtr->CounterSize));
+ __AT_PUT_(st_perCounter, @symbol(CounterOffset), __mkSmallInteger(perfCounterPtr->CounterOffset));
+
+ //put the counter type size
+ switch (perfCounterPtr->CounterType & PERF_SIZE_MASK) {
+ case PERF_SIZE_DWORD:
+ __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(DWORD));
+ break;
+ case PERF_SIZE_LARGE:
+ __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(LARGE));
+ break;
+ case PERF_SIZE_ZERO:
+ __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(ZERO));
+ break;
+ case PERF_SIZE_VARIABLE_LEN:
+ __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(VARIABLE_LEN));
+ break;
+ }
+ switch (perfCounterPtr->CounterType & PERF_TYPE_MASK) {
+ case PERF_TYPE_NUMBER:
+ __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(NUMBER));
+ switch (perfCounterPtr->CounterType & PERF_NUMBERTYPE_MASK) {
+ case PERF_NUMBER_HEX:
+ __AT_PUT_(st_perCounter, @symbol(NUMBER),@symbol(HEX));
+ break;
+ case PERF_NUMBER_DECIMAL:
+ __AT_PUT_(st_perCounter, @symbol(NUMBER),@symbol(DECIMAL));
+ break;
+ case PERF_NUMBER_DEC_1000:
+ __AT_PUT_(st_perCounter, @symbol(NUMBER),@symbol(DEC_1000));
+ break;
+ }
+ break;
+ case PERF_TYPE_COUNTER:
+ __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(COUNTER));
+ switch (perfCounterPtr->CounterType & PERF_COUNTERTYPE_MASK) {
+ case PERF_COUNTER_VALUE:
+ __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(VALUE));
+ break;
+ case PERF_COUNTER_RATE:
+ __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(RATE));
+ break;
+ case PERF_COUNTER_FRACTION:
+ __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(FRACTION));
+ break;
+ case PERF_COUNTER_BASE:
+ __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(BASE));
+ break;
+ case PERF_COUNTER_ELAPSED:
+ __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(ELAPSED));
+ break;
+ case PERF_COUNTER_QUEUELEN:
+ __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(QUEUELEN));
+ break;
+ case PERF_COUNTER_HISTOGRAM:
+ __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(HISTOGRAM));
+ break;
#ifdef PERF_COUNTER_PRECISION
- case PERF_COUNTER_PRECISION:
- __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(PRECISION));
- break;
-#endif
- }
- break;
- case PERF_TYPE_TEXT:
- __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(TEXT));
- switch (perfCounterPtr->CounterType & PERF_TEXTTYPE_MASK) {
- case PERF_TEXT_UNICODE:
- __AT_PUT_(st_perCounter, @symbol(TEXT),@symbol(UNICODE));
- break;
- case PERF_TEXT_ASCII:
- __AT_PUT_(st_perCounter, @symbol(TEXT),@symbol(ASCII));
- break;
- }
- break;
- case PERF_TYPE_ZERO:
- __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(ZERO));
- break;
- }
-
- //setup the counter pointer to the next counter definition
- perfCounterPtr = (PERF_COUNTER_DEFINITION *)((char *)perfCounterPtr + perfCounterPtr->ByteLength);
- }
-
- //goon dependent on the count of instances
- if (perfObjectPtr->NumInstances < 1) {
- perfCounterBlockPtr = (PERF_COUNTER_BLOCK *)(perfCounterPtr);
- __AT_PUT_(st_perObject, @symbol(RawData), __MKBYTEARRAY(perfCounterBlockPtr, perfCounterBlockPtr->ByteLength));
- } else {
- //setup the instance pointer to the end of all counters
- perfInstancePtr = (PERF_INSTANCE_DEFINITION *)(perfCounterPtr);
-
- //setup st_instanceArray and add it to st_perObject
- st_instanceArray = __ARRAY_NEW_INT(perfObjectPtr->NumInstances);
- __AT_PUT_(st_perObject, @symbol(Instances), st_instanceArray);
-
- //iterate the instances
- for (instanceIterator=0; instanceIterator<perfObjectPtr->NumInstances; instanceIterator++) {
- //setup st_perInstance and add it to st_instanceArray
- st_perInstance = __SSEND0(@global(Dictionary), @symbol(new), 0);
- __AT_PUT_(st_instanceArray, __mkSmallInteger(instanceIterator+1), st_perInstance);
-
- //get the instance data
- __AT_PUT_(st_perInstance, @symbol(Name), __MKBYTEARRAY((wchar_t *)((BYTE *)perfInstancePtr + perfInstancePtr->NameOffset),perfInstancePtr->NameLength));
- __AT_PUT_(st_perInstance, @symbol(ParentObjectTitleIndex), __mkSmallInteger(perfInstancePtr->ParentObjectTitleIndex));
- __AT_PUT_(st_perInstance, @symbol(ParentObjectInstance), __mkSmallInteger(perfInstancePtr->ParentObjectInstance));
- __AT_PUT_(st_perInstance, @symbol(NameOffset), __mkSmallInteger(perfInstancePtr->NameOffset));
- __AT_PUT_(st_perInstance, @symbol(NameLength), __mkSmallInteger(perfInstancePtr->NameLength));
-
- //setup the instance pointer to the its end
- perfInstancePtr = (PERF_INSTANCE_DEFINITION *)((char *)perfInstancePtr + perfInstancePtr->ByteLength);
-
- //setup the counter block pointer
- perfCounterBlockPtr = (PERF_COUNTER_BLOCK *)(perfInstancePtr);
-
- //get the instance raw data
- __AT_PUT_(st_perInstance, @symbol(RawData), __MKBYTEARRAY(perfCounterBlockPtr, perfCounterBlockPtr->ByteLength));
-
- //setup the instance pointer to the next instance
- perfInstancePtr = (PERF_INSTANCE_DEFINITION *)((char *)perfCounterBlockPtr + perfCounterBlockPtr->ByteLength);
- }
- }
-
- //setup the object pointer to the next object
- perfObjectPtr = (PERF_OBJECT_TYPE *)((char *)perfObjectPtr + perfObjectPtr->TotalByteLength);
+ case PERF_COUNTER_PRECISION:
+ __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(PRECISION));
+ break;
+#endif
+ }
+ break;
+ case PERF_TYPE_TEXT:
+ __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(TEXT));
+ switch (perfCounterPtr->CounterType & PERF_TEXTTYPE_MASK) {
+ case PERF_TEXT_UNICODE:
+ __AT_PUT_(st_perCounter, @symbol(TEXT),@symbol(UNICODE));
+ break;
+ case PERF_TEXT_ASCII:
+ __AT_PUT_(st_perCounter, @symbol(TEXT),@symbol(ASCII));
+ break;
+ }
+ break;
+ case PERF_TYPE_ZERO:
+ __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(ZERO));
+ break;
+ }
+
+ //setup the counter pointer to the next counter definition
+ perfCounterPtr = (PERF_COUNTER_DEFINITION *)((char *)perfCounterPtr + perfCounterPtr->ByteLength);
+ }
+
+ //goon dependent on the count of instances
+ if (perfObjectPtr->NumInstances < 1) {
+ perfCounterBlockPtr = (PERF_COUNTER_BLOCK *)(perfCounterPtr);
+ __AT_PUT_(st_perObject, @symbol(RawData), __MKBYTEARRAY(perfCounterBlockPtr, perfCounterBlockPtr->ByteLength));
+ } else {
+ //setup the instance pointer to the end of all counters
+ perfInstancePtr = (PERF_INSTANCE_DEFINITION *)(perfCounterPtr);
+
+ //setup st_instanceArray and add it to st_perObject
+ st_instanceArray = __ARRAY_NEW_INT(perfObjectPtr->NumInstances);
+ __AT_PUT_(st_perObject, @symbol(Instances), st_instanceArray);
+
+ //iterate the instances
+ for (instanceIterator=0; instanceIterator<perfObjectPtr->NumInstances; instanceIterator++) {
+ //setup st_perInstance and add it to st_instanceArray
+ st_perInstance = __SSEND0(@global(Dictionary), @symbol(new), 0);
+ __AT_PUT_(st_instanceArray, __mkSmallInteger(instanceIterator+1), st_perInstance);
+
+ //get the instance data
+ __AT_PUT_(st_perInstance, @symbol(Name), __MKBYTEARRAY((wchar_t *)((BYTE *)perfInstancePtr + perfInstancePtr->NameOffset),perfInstancePtr->NameLength));
+ __AT_PUT_(st_perInstance, @symbol(ParentObjectTitleIndex), __mkSmallInteger(perfInstancePtr->ParentObjectTitleIndex));
+ __AT_PUT_(st_perInstance, @symbol(ParentObjectInstance), __mkSmallInteger(perfInstancePtr->ParentObjectInstance));
+ __AT_PUT_(st_perInstance, @symbol(NameOffset), __mkSmallInteger(perfInstancePtr->NameOffset));
+ __AT_PUT_(st_perInstance, @symbol(NameLength), __mkSmallInteger(perfInstancePtr->NameLength));
+
+ //setup the instance pointer to the its end
+ perfInstancePtr = (PERF_INSTANCE_DEFINITION *)((char *)perfInstancePtr + perfInstancePtr->ByteLength);
+
+ //setup the counter block pointer
+ perfCounterBlockPtr = (PERF_COUNTER_BLOCK *)(perfInstancePtr);
+
+ //get the instance raw data
+ __AT_PUT_(st_perInstance, @symbol(RawData), __MKBYTEARRAY(perfCounterBlockPtr, perfCounterBlockPtr->ByteLength));
+
+ //setup the instance pointer to the next instance
+ perfInstancePtr = (PERF_INSTANCE_DEFINITION *)((char *)perfCounterBlockPtr + perfCounterBlockPtr->ByteLength);
+ }
+ }
+
+ //setup the object pointer to the next object
+ perfObjectPtr = (PERF_OBJECT_TYPE *)((char *)perfObjectPtr + perfObjectPtr->TotalByteLength);
}
%}.
objectArray := st_objectArray.
@@ -12354,61 +12354,61 @@
perfTime100nSec := st_perfTime100nSec.
getNameBlock := [:i|
- self class counterIndexTextDictionary at:i ifAbsent:['<<no name>>'].
+ self class counterIndexTextDictionary at:i ifAbsent:['<<no name>>'].
].
getCounterValueBlock := [:counter :rawData|
- |offset counterValue|
-
- offset := counter at:#CounterOffset.
- offset >= rawData size ifTrue:[
- counterValue := nil.
- ] ifFalse:[
- (counter at:#SIZE) == #LARGE ifTrue:[
- counterValue := rawData unsignedLongLongAt:offset + 1 bigEndian:false.
- ] ifFalse:[
- (counter at:#SIZE) == #DWORD ifTrue:[
- counterValue := rawData unsignedLongAt:offset + 1 bigEndian:false.
- ] ifFalse:[
- self halt.
- ].
- ].
- ].
-
- counterValue
+ |offset counterValue|
+
+ offset := counter at:#CounterOffset.
+ offset >= rawData size ifTrue:[
+ counterValue := nil.
+ ] ifFalse:[
+ (counter at:#SIZE) == #LARGE ifTrue:[
+ counterValue := rawData unsignedLongLongAt:offset + 1 bigEndian:false.
+ ] ifFalse:[
+ (counter at:#SIZE) == #DWORD ifTrue:[
+ counterValue := rawData unsignedLongAt:offset + 1 bigEndian:false.
+ ] ifFalse:[
+ self halt.
+ ].
+ ].
+ ].
+
+ counterValue
].
objectArray do:[:anObject|
- "setup the object name"
- anObject at:#ObjectNameTitle put:(getNameBlock value:(anObject at:#ObjectNameTitleIndex)).
-
- "setup the name and a counter value array to each counter"
- (anObject at:#Counters) do:[:aCounter|
- aCounter at:#CounterNameTitle put:(getNameBlock value:(aCounter at:#CounterNameTitleIndex)).
- aCounter at:#CounterValueArray put:OrderedCollection new.
- ].
-
- (anObject at:#NumInstances) < 1 ifTrue:[
- |rawData|
-
- rawData := anObject at:#RawData.
-
- (anObject at:#Counters) do:[:aCounter|
- (aCounter at:#CounterValueArray) add:(getCounterValueBlock value:aCounter value:rawData).
- ].
- ] ifFalse:[
- (anObject at:#Instances) do:[:anInstance|
- |rawData|
-
- rawData := anInstance at:#RawData.
-
- anInstance at:#Name put:((Unicode16String fromBytes:(anInstance at:#Name) copy swapBytes) copyButLast:1).
-
- (anObject at:#Counters) do:[:aCounter|
- (aCounter at:#CounterValueArray) add:(getCounterValueBlock value:aCounter value:rawData).
- ].
- ].
- ].
+ "setup the object name"
+ anObject at:#ObjectNameTitle put:(getNameBlock value:(anObject at:#ObjectNameTitleIndex)).
+
+ "setup the name and a counter value array to each counter"
+ (anObject at:#Counters) do:[:aCounter|
+ aCounter at:#CounterNameTitle put:(getNameBlock value:(aCounter at:#CounterNameTitleIndex)).
+ aCounter at:#CounterValueArray put:OrderedCollection new.
+ ].
+
+ (anObject at:#NumInstances) < 1 ifTrue:[
+ |rawData|
+
+ rawData := anObject at:#RawData.
+
+ (anObject at:#Counters) do:[:aCounter|
+ (aCounter at:#CounterValueArray) add:(getCounterValueBlock value:aCounter value:rawData).
+ ].
+ ] ifFalse:[
+ (anObject at:#Instances) do:[:anInstance|
+ |rawData|
+
+ rawData := anInstance at:#RawData.
+
+ anInstance at:#Name put:((Unicode16String fromBytes:(anInstance at:#Name) copy swapBytes) copyButLast:1).
+
+ (anObject at:#Counters) do:[:aCounter|
+ (aCounter at:#CounterValueArray) add:(getCounterValueBlock value:aCounter value:rawData).
+ ].
+ ].
+ ].
].
^ self
@@ -15526,25 +15526,25 @@
and nil is returned.
self fetchResourcesStartingAt: nil withScope: #GLOBALNET type: #ANY usage: 0
- onError: [:err| Transcript showCR: err ].
+ onError: [:err| Transcript showCR: err ].
"
| stream networkResources |
[
- stream := self openAt: aNetworkResourceOrNil
- withScope: aScope type: aType usage: aUsage onError: aBlock.
-
- stream notNil ifTrue:[
- |next|
-
- networkResources := OrderedCollection new.
-
- [ (next := stream nextOrNil) notNil ] whileTrue:[
- networkResources add:next.
- ].
- ]
+ stream := self openAt: aNetworkResourceOrNil
+ withScope: aScope type: aType usage: aUsage onError: aBlock.
+
+ stream notNil ifTrue:[
+ |next|
+
+ networkResources := OrderedCollection new.
+
+ [ (next := stream nextOrNil) notNil ] whileTrue:[
+ networkResources add:next.
+ ].
+ ]
] ensure:[
- stream notNil ifTrue:[ stream close ].
+ stream notNil ifTrue:[ stream close ].
].
^ networkResources.
!
@@ -15557,17 +15557,17 @@
and nil is returned.
self fetchSystemResourcesWithScope: #GLOBALNET type: #ANY usage: 0
- onError: [:err| Transcript showCR: err ].
+ onError: [:err| Transcript showCR: err ].
self fetchSystemResourcesWithScope: #REMEMBERED type: #DISK usage: 0
- onError: [:err| Transcript showCR: err ].
+ onError: [:err| Transcript showCR: err ].
self fetchSystemResourcesWithScope: #REMEMBERED type: #ANY usage: 0
- onError: [:err| Transcript showCR: err ].
+ onError: [:err| Transcript showCR: err ].
"
^ self fetchResourcesStartingAt: nil
- withScope: aScope type: aType usage: aUsage onError: aBlock
+ withScope: aScope type: aType usage: aUsage onError: aBlock
!
fetchVirtualDrives
@@ -15714,7 +15714,7 @@
do {
__threadErrno = 0;
#ifdef USE_ANSI_NETWORKRESOURCES
- __errno = STX_API_NOINT_CALL5( "WNetOpenEnum", WNetOpenEnum, __scope, __type, __usage, __lpnetRes, & __hEnum );
+ __errno = STX_API_NOINT_CALL5( "WNetOpenEnumA", WNetOpenEnumA, __scope, __type, __usage, __lpnetRes, & __hEnum );
#else
__errno = STX_API_NOINT_CALL5( "WNetOpenEnumW", WNetOpenEnumW, __scope, __type, __usage, __lpnetRes, & __hEnum );
#endif
@@ -15722,7 +15722,7 @@
#else
#ifdef USE_ANSI_NETWORKRESOURCES
- __errno = WNetOpenEnum ( __scope, __type, __usage, __lpnetRes, & __hEnum );
+ __errno = WNetOpenEnumA ( __scope, __type, __usage, __lpnetRes, & __hEnum );
#else
__errno = WNetOpenEnumW( __scope, __type, __usage, __lpnetRes, & __hEnum );
#endif
@@ -15790,7 +15790,7 @@
LPNETRESOURCE __lpNetRes = (LPNETRESOURCE) __buffer;
ZeroMemory( __buffer, sizeof(NETRESOURCE) );
- __errno = WNetEnumResource ( __hEnum , & __entries , __lpNetRes, & __bufSize );
+ __errno = WNetEnumResourceA ( __hEnum , & __entries , __lpNetRes, & __bufSize );
#else
wchar_t __buffer[ 8192 ];
LPNETRESOURCEW __lpNetRes = (LPNETRESOURCEW) __buffer;
@@ -17105,11 +17105,11 @@
!Win32OperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.460 2013-04-25 14:11:57 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.461 2013-04-26 12:42:53 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.460 2013-04-25 14:11:57 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.461 2013-04-26 12:42:53 cg Exp $'
!
version_SVN