Win32OperatingSystem.st
changeset 19338 4733b348640d
parent 19336 1604ec6ee7c2
child 19339 8d679a172fab
--- a/Win32OperatingSystem.st	Fri Mar 11 13:07:48 2016 +0100
+++ b/Win32OperatingSystem.st	Fri Mar 11 13:15:17 2016 +0100
@@ -1688,7 +1688,7 @@
 
 	do {
 	    __threadErrno = 0;
-	    rslt = STX_API_NOINT_CALL2( "FindNextFileW", FindNextFileW, d, &data );
+	    rslt = (int)(STX_API_NOINT_CALL2( "FindNextFileW", FindNextFileW, d, &data ));
 	} while ((rslt < 0) && (__threadErrno == EINTR));
 
 	if (rslt > 0) {
@@ -4588,7 +4588,7 @@
 	    do {
 		__threadErrno = 0;
 		// do not cast to INT - will loose sign bit then!
-		ret = STX_API_NOINT_CALL1( "RemoveDirectoryA", RemoveDirectoryA, _aPathName);
+		ret = (int)(STX_API_NOINT_CALL1( "RemoveDirectoryA", RemoveDirectoryA, _aPathName));
 	    } while ((ret < 0) && (__threadErrno == EINTR));
 	}
 #else
@@ -4616,7 +4616,7 @@
 	    do {
 		__threadErrno = 0;
 		// do not cast to INT - will loose sign bit then!
-		ret = STX_API_NOINT_CALL1( "RemoveDirectoryW", RemoveDirectoryW, _wPathName);
+		ret = (int)(STX_API_NOINT_CALL1( "RemoveDirectoryW", RemoveDirectoryW, _wPathName));
 	    } while ((ret < 0) && (__threadErrno == EINTR));
 	}
 #else
@@ -4658,7 +4658,7 @@
 	    do {
 		__threadErrno = 0;
 		// do not cast to INT - will loose sign bit then!
-		ret = STX_API_NOINT_CALL1( "DeleteFileA", DeleteFileA, _aPathName);
+		ret = (int)(STX_API_NOINT_CALL1( "DeleteFileA", DeleteFileA, _aPathName));
 	    } while ((ret < 0) && (__threadErrno == EINTR));
 	}
 #else
@@ -4686,7 +4686,7 @@
 	    do {
 		__threadErrno = 0;
 		// do not cast to INT - will loose sign bit then!
-		ret = STX_API_NOINT_CALL1( "DeleteFileW", DeleteFileW, _wPathName);
+		ret = (int)(STX_API_NOINT_CALL1( "DeleteFileW", DeleteFileW, _wPathName));
 	    } while ((ret < 0) && (__threadErrno == EINTR));
 	}
 #else
@@ -5343,7 +5343,7 @@
 	do {
 	    __threadErrno = 0;
 	    // do not cast to INT - will loose sign bit then!
-	    ret = STX_API_NOINT_CALL1( "GetDriveType", GetDriveType, _aPathName);
+	    ret = (int)(STX_API_NOINT_CALL1( "GetDriveType", GetDriveType, _aPathName));
 	} while ((ret < 0) && (__threadErrno == EINTR));
 #else
 	ret = GetDriveType((char *) __stringVal(aPathName));
@@ -5435,7 +5435,7 @@
      do {
 	 __threadErrno = 0;
 	 // do not cast to INT - will loose sign bit then!
-	 ret = STX_API_NOINT_CALL3( "GetLongPathNameW", GetLongPathNameW, _aPathName, _aPathName, MAXPATHLEN);
+	 ret = (int)(STX_API_NOINT_CALL3( "GetLongPathNameW", GetLongPathNameW, _aPathName, _aPathName, MAXPATHLEN));
      } while ((ret == 0) && (__threadErrno == EINTR));
 #else
      ret = GetLongPathNameW(_aPathName, _aPathName, MAXPATHLEN);
@@ -5510,7 +5510,7 @@
      do {
 	 __threadErrno = 0;
 	 // do not cast to INT - will loose sign bit then!
-	 ret = STX_API_NOINT_CALL3( "GetShortPathNameW", GetShortPathNameW, _aPathName, _aPathName, MAXPATHLEN);
+	 ret = (int)(STX_API_NOINT_CALL3( "GetShortPathNameW", GetShortPathNameW, _aPathName, _aPathName, MAXPATHLEN));
      } while ((ret == 0) && (__threadErrno == EINTR));
 #else
      ret = GetShortPathNameW(_aPathName, _aPathName, MAXPATHLEN);
@@ -5605,7 +5605,7 @@
 	do {
 	    __threadErrno = 0;
 	    // do not cast to INT - will loose sign bit then!
-	    ret = STX_API_NOINT_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName);
+	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName));
 	} while ((ret == -1) && (__threadErrno == EINTR));
 #else
 	ret = GetFileAttributesA((char *) __stringVal(aPathName));
@@ -5627,7 +5627,7 @@
 	do {
 	    __threadErrno = 0;
 	    // do not cast to INT - will loose sign bit then!
-	    ret = STX_API_NOINT_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
+	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName));
 	} while ((ret == -1) && (__threadErrno == EINTR));
 #else
 	ret = GetFileAttributesW(_wPathName);
@@ -5705,7 +5705,7 @@
 	do {
 	    __threadErrno = 0;
 	    // do not cast to INT - will loose sign bit then!
-	    ret = STX_API_NOINT_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName);
+	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName));
 	} while ((ret < 0) && (__threadErrno == EINTR));
 #else
 	ret = GetFileAttributesA((char *) __stringVal(aPathName));
@@ -5740,7 +5740,7 @@
 	do {
 	    __threadErrno = 0;
 	    // do not cast to INT - will loose sign bit then!
-	    ret = STX_API_NOINT_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
+	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName));
 	} while ((ret < 0) && (__threadErrno == EINTR));
 #else
 	ret = GetFileAttributesW(_wPathName);
@@ -5793,7 +5793,7 @@
 	do {
 	    __threadErrno = 0;
 	    // do not cast to INT - will loose sign bit then!
-	    ret = STX_API_NOINT_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName);
+	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName));
 	} while ((ret == -1) && (__threadErrno == EINTR));
 #else
 	ret = GetFileAttributesA((char *) __stringVal(aPathName));
@@ -5815,7 +5815,7 @@
 	do {
 	    __threadErrno = 0;
 	    // do not cast to INT - will loose sign bit then!
-	    ret = STX_API_NOINT_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
+	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName));
 	} while ((ret == -1) && (__threadErrno == EINTR));
 #else
 	ret = GetFileAttributesW(_wPathName);
@@ -5934,7 +5934,7 @@
 	do {
 	    __threadErrno = 0;
 	    // do not cast to INT - will loose sign bit then!
-	    result = STX_API_NOINT_CALL3( "GetFileAttributesExW", GetFileAttributesExW, _aPathName, GetFileExInfoStandard, &fileAttributeData);
+	    result = (int)(STX_API_NOINT_CALL3( "GetFileAttributesExW", GetFileAttributesExW, _aPathName, GetFileExInfoStandard, &fileAttributeData));
 	} while (!result && (__threadErrno == EINTR));
     }
 #else
@@ -6137,7 +6137,7 @@
 	do {
 	    __threadErrno = 0;
 	    // do not cast to INT - will loose sign bit then!
-	    ret = STX_API_NOINT_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName);
+	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesA", GetFileAttributesA, _aPathName));
 	} while ((ret < 0) && (__threadErrno == EINTR));
 #else
 	ret = GetFileAttributesA((char *) __stringVal(aPathName));
@@ -6166,7 +6166,7 @@
 	do {
 	    __threadErrno = 0;
 	    // do not cast to INT - will loose sign bit then!
-	    ret = STX_API_NOINT_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName);
+	    ret = (int)(STX_API_NOINT_CALL1( "GetFileAttributesW", GetFileAttributesW, _wPathName));
 	} while ((ret < 0) && (__threadErrno == EINTR));
 #else
 	ret = GetFileAttributesW(_wPathName);
@@ -6221,7 +6221,7 @@
 	do {
 	    __threadErrno = 0;
 	    // do not cast to INT - will loose sign bit then!
-	    rslt = STX_API_NOINT_CALL4( "GetFullPathNameA", GetFullPathNameA, _aPathName, MAXPATHLEN, nameBuffer, NULL);
+	    rslt = (int)(STX_API_NOINT_CALL4( "GetFullPathNameA", GetFullPathNameA, _aPathName, MAXPATHLEN, nameBuffer, NULL));
 	} while ((rslt < 0) && (__threadErrno == EINTR));
 #else
 	rslt = GetFullPathNameA(__stringVal(aPathName), MAXPATHLEN, nameBuffer, NULL);
@@ -6233,7 +6233,7 @@
 	    do {
 		__threadErrno = 0;
 		// do not cast to INT - will loose sign bit then!
-		rslt = STX_API_NOINT_CALL3( "GetLongPathNameA", GetLongPathNameA, nameBuffer, nameBuffer2, MAXPATHLEN);
+		rslt = (int)(STX_API_NOINT_CALL3( "GetLongPathNameA", GetLongPathNameA, nameBuffer, nameBuffer2, MAXPATHLEN));
 	    } while ((rslt < 0) && (__threadErrno == EINTR));
 #else
 	    rslt = GetLongPathNameA(nameBuffer, nameBuffer2, MAXPATHLEN);
@@ -6264,7 +6264,7 @@
 #ifdef DO_WRAP_CALLS
 	do {
 	    __threadErrno = 0;
-	    rslt = (INT)STX_API_NOINT_CALL4( "GetFullPathNameW", GetFullPathNameW, _aPathName, MAXPATHLEN, nameBuffer, NULL);
+	    rslt = (int)(STX_API_NOINT_CALL4( "GetFullPathNameW", GetFullPathNameW, _aPathName, MAXPATHLEN, nameBuffer, NULL));
 	} while ((rslt < 0) && (__threadErrno == EINTR));
 #else
 	rslt = GetFullPathNameW(_aPathName, MAXPATHLEN, nameBuffer, NULL);
@@ -6277,7 +6277,7 @@
 #ifdef DO_WRAP_CALLS
 	    do {
 		__threadErrno = 0;
-		rslt = (INT)STX_API_NOINT_CALL3( "GetLongPathNameW", GetLongPathNameW, nameBuffer, nameBuffer2, MAXPATHLEN);
+		rslt = (int)(STX_API_NOINT_CALL3( "GetLongPathNameW", GetLongPathNameW, nameBuffer, nameBuffer2, MAXPATHLEN));
 	    } while ((rslt < 0) && (__threadErrno == EINTR));
 #else
 	    rslt = GetLongPathNameW(nameBuffer, nameBuffer2, MAXPATHLEN);
@@ -6340,7 +6340,7 @@
 	    do {
 		__threadErrno = 0;
 		// do not cast to INT - will loose sign bit then!
-		ret = STX_API_NOINT_CALL2( "SetFileAttributesA", SetFileAttributesA, _aPathName, __intVal(anInteger) );
+		ret = (int)(STX_API_NOINT_CALL2( "SetFileAttributesA", SetFileAttributesA, _aPathName, __intVal(anInteger)));
 	    } while ((ret < 0) && (__threadErrno == EINTR));
 #else
 	    ret = SetFileAttributesA((char *) __stringVal(aPathName), __intVal(anInteger));
@@ -6369,7 +6369,7 @@
 	    do {
 		__threadErrno = 0;
 		// do not cast to INT - will loose sign bit then!
-		ret = STX_API_NOINT_CALL2( "SetFileAttributesW", SetFileAttributesW, _wPathName, __intVal(anInteger) );
+		ret = (int)(STX_API_NOINT_CALL2( "SetFileAttributesW", SetFileAttributesW, _wPathName, __intVal(anInteger)));
 	    } while ((ret < 0) && (__threadErrno == EINTR));
 #else
 	    ret = SetFileAttributesW(_wPathName, __intVal(anInteger));
@@ -6654,7 +6654,7 @@
 
     do {
 	// do not cast to INT - will loose sign bit then!
-	ret = STX_API_NOINT_CALL1("Sleep", Sleep, 60000);
+	ret = (int)(STX_API_NOINT_CALL1("Sleep", Sleep, 60000));
     } while (ret < 0 && __threadErrno == EINTR);
 %}.
     "
@@ -15477,30 +15477,30 @@
 
     if (__isExternalAddressLike(__INST(handle))
      && __isSmallInteger(subKeyIndex)) {
-        myKey = (HKEY)__externalAddressVal(__INST(handle));
-        if ((_retVal = RegEnumKeyExA(myKey, __intVal(subKeyIndex),
-                         nameBuffer, &nameSize,
-                         NULL,
-                         classNameBuffer, &classNameSize,
-                         &modificationTime)) == ERROR_SUCCESS) {
-            nameBuffer[nameSize] = '\0';
-            classNameBuffer[classNameSize] = '\0';
-            subKeyName = __MKSTRING(nameBuffer);
-            subKeyClassName = __MKSTRING(classNameBuffer);
-        } else {
-            if ((_retVal != ERROR_PATH_NOT_FOUND)
-             && (_retVal != ERROR_FILE_NOT_FOUND)
-             && (_retVal != ERROR_NO_MORE_ITEMS)) {
-                errorNumber = __MKSMALLINT(_retVal);
-            }
-        }
+	myKey = (HKEY)__externalAddressVal(__INST(handle));
+	if ((_retVal = RegEnumKeyExA(myKey, __intVal(subKeyIndex),
+			 nameBuffer, &nameSize,
+			 NULL,
+			 classNameBuffer, &classNameSize,
+			 &modificationTime)) == ERROR_SUCCESS) {
+	    nameBuffer[nameSize] = '\0';
+	    classNameBuffer[classNameSize] = '\0';
+	    subKeyName = __MKSTRING(nameBuffer);
+	    subKeyClassName = __MKSTRING(classNameBuffer);
+	} else {
+	    if ((_retVal != ERROR_PATH_NOT_FOUND)
+	     && (_retVal != ERROR_FILE_NOT_FOUND)
+	     && (_retVal != ERROR_NO_MORE_ITEMS)) {
+		errorNumber = __MKSMALLINT(_retVal);
+	    }
+	}
     }
 %}.
     subKeyName notNil ifTrue:[
-        ^ {subKeyName . subKeyClassName}.
+	^ {subKeyName . subKeyClassName}.
     ].
     errorNumber notNil ifTrue:[
-        (OperatingSystem errorHolderForNumber:errorNumber) reportError.
+	(OperatingSystem errorHolderForNumber:errorNumber) reportError.
     ].
     ^ nil
 
@@ -15744,11 +15744,11 @@
 
 valueNamed:aValueName
     "retrieve a value; the returned object depends upon the type:
-        REG_BINARY      -> ByteArray
-        REG_SZ          -> String
-        REG_MULTI_SZ    -> Array of strings
-        REG_DWORD       -> Integer
-        REG_NONE        -> nil
+	REG_BINARY      -> ByteArray
+	REG_SZ          -> String
+	REG_MULTI_SZ    -> Array of strings
+	REG_DWORD       -> Integer
+	REG_NONE        -> nil
     "
 
     |stringArray retVal errorNumber|
@@ -15757,9 +15757,9 @@
     HKEY myKey;
     DWORD valueType;
     union {
-        DWORD dWord;
-        unsigned char dWordBytes[4];
-        unsigned char smallDataBuffer[1024*16];
+	DWORD dWord;
+	unsigned char dWordBytes[4];
+	unsigned char smallDataBuffer[1024*16];
     } quickData;
     int val;
     DWORD dataSize = sizeof(quickData);
@@ -15775,166 +15775,166 @@
 
     if (__isExternalAddressLike(__INST(handle))
      && __isStringLike(aValueName)) {
-        int ret;
-
-        myKey = (HKEY)__externalAddressVal(__INST(handle));
-
-        /*
-         * try to get it with one call ...
-         */
-        ret = RegQueryValueEx(myKey, __stringVal(aValueName),
-                         NULL,
-                         &valueType,
-                         (char *)&quickData,
-                         &dataSize);
+	int ret;
+
+	myKey = (HKEY)__externalAddressVal(__INST(handle));
+
+	/*
+	 * try to get it with one call ...
+	 */
+	ret = RegQueryValueEx(myKey, __stringVal(aValueName),
+			 NULL,
+			 &valueType,
+			 (char *)&quickData,
+			 &dataSize);
 #if 0
-        console_printf("dataSize=%d\n", dataSize);
-#endif
-        while (ret == ERROR_MORE_DATA) {
+	console_printf("dataSize=%d\n", dataSize);
+#endif
+	while (ret == ERROR_MORE_DATA) {
 #if 0
-            console_printf("ERROR_MORE_DATA dataSize=%d\n", dataSize);
-            console_printf("valueType=%d\n", valueType);
-#endif
-            /*
-             * nope - need another one ...
-             */
-            if (myKey = HKEY_PERFORMANCE_DATA) {
-                dataSize = dataSize * 2;
-            }
-            switch (valueType) {
-                case REG_BINARY:
-                case REG_MULTI_SZ:
-                    dataBuffer = malloc(dataSize);;
-                    break;
-                case REG_SZ:
-                    dataBuffer = malloc(dataSize);
-                    break;
-                default:
-                    console_printf("RegistryEntry [warning]: unhandled valueType: %d\n", valueType);
-                    break;
-            }
-            if (dataBuffer) {
-                ret = RegQueryValueEx(myKey, __stringVal(aValueName),
-                                 NULL,
-                                 &valueType,
-                                 dataBuffer,
-                                 &dataSize);
-            } else {
-                break;
-            }
-            if (myKey != HKEY_PERFORMANCE_DATA) {
-                if (ret != ERROR_SUCCESS) break;
-            }
-        }
-
-        if (ret == ERROR_SUCCESS) {
+	    console_printf("ERROR_MORE_DATA dataSize=%d\n", dataSize);
+	    console_printf("valueType=%d\n", valueType);
+#endif
+	    /*
+	     * nope - need another one ...
+	     */
+	    if (myKey = HKEY_PERFORMANCE_DATA) {
+		dataSize = dataSize * 2;
+	    }
+	    switch (valueType) {
+		case REG_BINARY:
+		case REG_MULTI_SZ:
+		    dataBuffer = malloc(dataSize);;
+		    break;
+		case REG_SZ:
+		    dataBuffer = malloc(dataSize);
+		    break;
+		default:
+		    console_printf("RegistryEntry [warning]: unhandled valueType: %d\n", valueType);
+		    break;
+	    }
+	    if (dataBuffer) {
+		ret = RegQueryValueEx(myKey, __stringVal(aValueName),
+				 NULL,
+				 &valueType,
+				 dataBuffer,
+				 &dataSize);
+	    } else {
+		break;
+	    }
+	    if (myKey != HKEY_PERFORMANCE_DATA) {
+		if (ret != ERROR_SUCCESS) break;
+	    }
+	}
+
+	if (ret == ERROR_SUCCESS) {
 #if 0
-            console_printf("ERROR_SUCCESS dataSize=%d\n", dataSize);
-            console_printf("valueType=%d\n", valueType);
-#endif
-            switch (valueType) {
-                case REG_NONE:
-                    /* RETURN (@symbol(none));  */
-                    retVal = nil;
-                    break;
-
-                case REG_BINARY:
-                    retVal = __MKBYTEARRAY(dataBuffer ? dataBuffer : quickData.smallDataBuffer, dataSize);
-                    break;
-
-                case REG_SZ:
-                case REG_EXPAND_SZ:
+	    console_printf("ERROR_SUCCESS dataSize=%d\n", dataSize);
+	    console_printf("valueType=%d\n", valueType);
+#endif
+	    switch (valueType) {
+		case REG_NONE:
+		    /* RETURN (@symbol(none));  */
+		    retVal = nil;
+		    break;
+
+		case REG_BINARY:
+		    retVal = __MKBYTEARRAY(dataBuffer ? dataBuffer : quickData.smallDataBuffer, dataSize);
+		    break;
+
+		case REG_SZ:
+		case REG_EXPAND_SZ:
 #ifdef USE_UNICODE
-                    retVal = __MKU16STRING(dataBuffer ? dataBuffer : quickData.smallDataBuffer);
-#else
-                    retVal = __MKSTRING(dataBuffer ? dataBuffer : quickData.smallDataBuffer);
-#endif
-                    break;
+		    retVal = __MKU16STRING(dataBuffer ? dataBuffer : quickData.smallDataBuffer);
+#else
+		    retVal = __MKSTRING(dataBuffer ? dataBuffer : quickData.smallDataBuffer);
+#endif
+		    break;
 
 #if 0
-                case REG_DWORD:
-                    /* int in native format */
-                    retVal = __MKUINT(quickData.dWord);
-                    break;
-#endif
-                case REG_DWORD_LITTLE_ENDIAN:
-                    val = quickData.dWordBytes[3];
-                    val = (val << 8) | quickData.dWordBytes[2];
-                    val = (val << 8) | quickData.dWordBytes[1];
-                    val = (val << 8) | quickData.dWordBytes[0];
-                    retVal = __MKUINT(val);
-                    break;
-
-                case REG_DWORD_BIG_ENDIAN:
-                    val = quickData.dWordBytes[0];
-                    val = (val << 8) | quickData.dWordBytes[1];
-                    val = (val << 8) | quickData.dWordBytes[2];
-                    val = (val << 8) | quickData.dWordBytes[3];
-                    retVal = __MKUINT(val);
-                    break;
-
-                case REG_MULTI_SZ:
-                    {
-                        CHAR *cp, *cp0;
-                        int ns, i;
-
-                        cp0 = dataBuffer ? dataBuffer : quickData.smallDataBuffer;
+		case REG_DWORD:
+		    /* int in native format */
+		    retVal = __MKUINT(quickData.dWord);
+		    break;
+#endif
+		case REG_DWORD_LITTLE_ENDIAN:
+		    val = quickData.dWordBytes[3];
+		    val = (val << 8) | quickData.dWordBytes[2];
+		    val = (val << 8) | quickData.dWordBytes[1];
+		    val = (val << 8) | quickData.dWordBytes[0];
+		    retVal = __MKUINT(val);
+		    break;
+
+		case REG_DWORD_BIG_ENDIAN:
+		    val = quickData.dWordBytes[0];
+		    val = (val << 8) | quickData.dWordBytes[1];
+		    val = (val << 8) | quickData.dWordBytes[2];
+		    val = (val << 8) | quickData.dWordBytes[3];
+		    retVal = __MKUINT(val);
+		    break;
+
+		case REG_MULTI_SZ:
+		    {
+			CHAR *cp, *cp0;
+			int ns, i;
+
+			cp0 = dataBuffer ? dataBuffer : quickData.smallDataBuffer;
 #if 0
-                        console_printf("**************\n");
-                        for (i=0;i<50;i++) {
-                          console_printf("%x ", cp0[i]);
-                        }
-                        console_printf("\n");
-                        for (i=0;i<50;i++) {
-                          if (cp0[i] == 0)
-                            console_printf("\n");
-                          else
-                            console_printf("%c", cp0[i]);
-                        }
-                        console_printf("\n");
-                        console_printf("**************\n");
-#endif
-                        cp = cp0;
-                        ns = 0;
-                        while (*cp) {
-                            while (*cp++) ;;
-                            ns++;
-                        }
-                        stringArray = __ARRAY_NEW_INT(ns);
-
-                        i = 0;
-                        while (*cp0) {
-                            OBJ s;
-                            CHAR *cp;
-
-                            cp = cp0;
-                            while (*cp++) ;;
+			console_printf("**************\n");
+			for (i=0;i<50;i++) {
+			  console_printf("%x ", cp0[i]);
+			}
+			console_printf("\n");
+			for (i=0;i<50;i++) {
+			  if (cp0[i] == 0)
+			    console_printf("\n");
+			  else
+			    console_printf("%c", cp0[i]);
+			}
+			console_printf("\n");
+			console_printf("**************\n");
+#endif
+			cp = cp0;
+			ns = 0;
+			while (*cp) {
+			    while (*cp++) ;;
+			    ns++;
+			}
+			stringArray = __ARRAY_NEW_INT(ns);
+
+			i = 0;
+			while (*cp0) {
+			    OBJ s;
+			    CHAR *cp;
+
+			    cp = cp0;
+			    while (*cp++) ;;
 #ifdef USE_UNICODE
-                            s = __MKU16STRING(cp0); __ArrayInstPtr(stringArray)->a_element[i] = s; __STORE(stringArray, s);
-#else
-                            s = __MKSTRING(cp0); __ArrayInstPtr(stringArray)->a_element[i] = s; __STORE(stringArray, s);
-#endif
-                            cp0 = cp;
-                            i++;
-                        }
-                        retVal = stringArray;
-                        break;
-                    }
-                default:
-                    console_printf("RegistryEntry [warning]: unhandled valueType: %d\n", valueType);
-                    break;
-            }
-        } else {
-            if ((ret != ERROR_PATH_NOT_FOUND)
-             && (ret != ERROR_FILE_NOT_FOUND)) {
-                errorNumber = __MKSMALLINT(ret);
-            }
-        }
+			    s = __MKU16STRING(cp0); __ArrayInstPtr(stringArray)->a_element[i] = s; __STORE(stringArray, s);
+#else
+			    s = __MKSTRING(cp0); __ArrayInstPtr(stringArray)->a_element[i] = s; __STORE(stringArray, s);
+#endif
+			    cp0 = cp;
+			    i++;
+			}
+			retVal = stringArray;
+			break;
+		    }
+		default:
+		    console_printf("RegistryEntry [warning]: unhandled valueType: %d\n", valueType);
+		    break;
+	    }
+	} else {
+	    if ((ret != ERROR_PATH_NOT_FOUND)
+	     && (ret != ERROR_FILE_NOT_FOUND)) {
+		errorNumber = __MKSMALLINT(ret);
+	    }
+	}
     }
     if (dataBuffer) free(dataBuffer);
 %}.
     errorNumber notNil ifTrue:[
-        (OperatingSystem errorHolderForNumber:errorNumber) reportError.
+	(OperatingSystem errorHolderForNumber:errorNumber) reportError.
     ].
 
     ^ retVal
@@ -16107,12 +16107,12 @@
 
     idx := 0.
     [true] whileTrue:[
-        nameAndClassNameOrNil := self subKeyNameAndClassAtIndex:idx.
-        nameAndClassNameOrNil isNil ifTrue:[
-            ^self
-        ].
-        aTwoArgBlock value:nameAndClassNameOrNil first value:nameAndClassNameOrNil second.
-        idx := idx + 1.
+	nameAndClassNameOrNil := self subKeyNameAndClassAtIndex:idx.
+	nameAndClassNameOrNil isNil ifTrue:[
+	    ^self
+	].
+	aTwoArgBlock value:nameAndClassNameOrNil first value:nameAndClassNameOrNil second.
+	idx := idx + 1.
     ]
 
     "
@@ -16120,7 +16120,7 @@
 
      top := self key:'HKEY_LOCAL_MACHINE'.
      top subKeyNamesAndClassesDo:[:nm :cls |
-        Transcript showCR:('name: ',nm,' class: ',cls)
+	Transcript showCR:('name: ',nm,' class: ',cls)
      ]
     "
 !
@@ -16423,7 +16423,7 @@
     do {
 	__threadErrno = 0;
 	// do not cast to INT - will loose sign bit then!
-	ok = STX_API_NOINT_CALL5( "ReadFile", ReadFile, hFile, extPtr, cntWanted, &cntRead, 0 /* lpOverlapped */);
+	ok = (int)(STX_API_NOINT_CALL5( "ReadFile", ReadFile, hFile, extPtr, cntWanted, &cntRead, 0 /* lpOverlapped */));
     } while(__threadErrno == EINTR);
 
     if (ok == TRUE) {
@@ -16676,7 +16676,7 @@
     do {
 	__threadErrno = 0;
 	// do not cast to INT - will loose sign bit then!
-	ok = STX_API_NOINT_CALL5( "WriteFile", WriteFile, hFile, extPtr, cntWanted, &cntWritten, 0 /* lpOverlapped */);
+	ok = (int)(STX_API_NOINT_CALL5( "WriteFile", WriteFile, hFile, extPtr, cntWanted, &cntWritten, 0 /* lpOverlapped */));
     } while(__threadErrno == EINTR);
 
     if (ok == TRUE) {
@@ -17023,7 +17023,7 @@
 	__threadErrno = 0;
 #ifdef USE_ANSI_NETWORKRESOURCES
 	// do not cast to INT - will loose sign bit then!
-	__errno = STX_API_NOINT_CALL5( "WNetOpenEnumA",  WNetOpenEnumA,  __scope, __type, __usage, __lpnetRes, & __hEnum );
+	__errno = (int)(STX_API_NOINT_CALL5( "WNetOpenEnumA",  WNetOpenEnumA,  __scope, __type, __usage, __lpnetRes, & __hEnum ));
 #else
 	// do not cast to INT - will loose sign bit then!
 	__errno = STX_API_NOINT_CALL5( "WNetOpenEnumW", WNetOpenEnumW, __scope, __type, __usage, __lpnetRes, & __hEnum );
@@ -17857,7 +17857,7 @@
 	do {
 	    __threadErrno = 0;
 	    // do not cast to INT - will loose sign bit then!
-	    ret = STX_WSA_NOINT_CALL4( "getaddrinfo", getaddrinfo, __hostName, __serviceName, &hints, &info);
+	    ret = (int)(STX_WSA_NOINT_CALL4( "getaddrinfo", getaddrinfo, __hostName, __serviceName, &hints, &info));
 	} while ((ret < 0) && (__threadErrno == EINTR));
 # else
 	__BEGIN_INTERRUPTABLE__