Win32OperatingSystem.st
changeset 7662 32a1185158f3
parent 7645 fd98d4cfa617
child 7664 6fcd1da5716f
equal deleted inserted replaced
7661:71d2cac1b959 7662:32a1185158f3
  2757 
  2757 
  2758 %{
  2758 %{
  2759     DWORD endStatus;
  2759     DWORD endStatus;
  2760     int status = -1;
  2760     int status = -1;
  2761 
  2761 
  2762     if (__isExternalAddress(aProcessId)) {
  2762     if (__isExternalAddressLike(aProcessId)) {
  2763 	HANDLE handle = _HANDLEVal(aProcessId);
  2763 	HANDLE handle = _HANDLEVal(aProcessId);
  2764 	if (handle) {
  2764 	if (handle) {
  2765 #ifdef DO_WRAP_CALLS
  2765 #ifdef DO_WRAP_CALLS
  2766 	    do {    
  2766 	    do {    
  2767 		__threadErrno = 0;
  2767 		__threadErrno = 0;
  2968 	    lpsiStartInfo.hStdInput  = (HANDLE) _get_osfhandle (0);
  2968 	    lpsiStartInfo.hStdInput  = (HANDLE) _get_osfhandle (0);
  2969 	    lpsiStartInfo.hStdOutput = (HANDLE) _get_osfhandle (1);
  2969 	    lpsiStartInfo.hStdOutput = (HANDLE) _get_osfhandle (1);
  2970 	    lpsiStartInfo.hStdError  = (HANDLE) _get_osfhandle (2);
  2970 	    lpsiStartInfo.hStdError  = (HANDLE) _get_osfhandle (2);
  2971 	} else if (__isArray(fdArray) && (__arraySize(fdArray) >= 3)) {
  2971 	} else if (__isArray(fdArray) && (__arraySize(fdArray) >= 3)) {
  2972 	    if (__ArrayInstPtr(fdArray)->a_element[0] != nil) {
  2972 	    if (__ArrayInstPtr(fdArray)->a_element[0] != nil) {
  2973 		if (__isExternalAddress(__ArrayInstPtr(fdArray)->a_element[0])) {
  2973 		if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[0])) {
  2974 		    lpsiStartInfo.hStdInput = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[0]);
  2974 		    lpsiStartInfo.hStdInput = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[0]);
  2975 		} else {
  2975 		} else {
  2976 		    lpsiStartInfo.hStdInput = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[0]));
  2976 		    lpsiStartInfo.hStdInput = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[0]));
  2977 		}
  2977 		}
  2978 	    }
  2978 	    }
  2979 	    if (__ArrayInstPtr(fdArray)->a_element[1] != nil) {
  2979 	    if (__ArrayInstPtr(fdArray)->a_element[1] != nil) {
  2980 		if (__isExternalAddress(__ArrayInstPtr(fdArray)->a_element[1])) {
  2980 		if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[1])) {
  2981 		    lpsiStartInfo.hStdOutput = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[1]);
  2981 		    lpsiStartInfo.hStdOutput = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[1]);
  2982 		} else {
  2982 		} else {
  2983 		    lpsiStartInfo.hStdOutput = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[1]));
  2983 		    lpsiStartInfo.hStdOutput = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[1]));
  2984 		}
  2984 		}
  2985 	    }
  2985 	    }
  2986 	    if (__ArrayInstPtr(fdArray)->a_element[2] != nil) {
  2986 	    if (__ArrayInstPtr(fdArray)->a_element[2] != nil) {
  2987 		if (__isExternalAddress(__ArrayInstPtr(fdArray)->a_element[2])) {
  2987 		if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[2])) {
  2988 		    lpsiStartInfo.hStdError  = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[2]);
  2988 		    lpsiStartInfo.hStdError  = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[2]);
  2989 		} else {
  2989 		} else {
  2990 		    lpsiStartInfo.hStdError = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[2]));
  2990 		    lpsiStartInfo.hStdError = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[2]));
  2991 		}
  2991 		}
  2992 	    }
  2992 	    }
  3125     "Created: / 12.11.1998 / 14:39:20 / cg"
  3125     "Created: / 12.11.1998 / 14:39:20 / cg"
  3126 ! !
  3126 ! !
  3127 
  3127 
  3128 !Win32OperatingSystem class methodsFor:'file access'!
  3128 !Win32OperatingSystem class methodsFor:'file access'!
  3129 
  3129 
  3130 closeFd:anInteger
  3130 closeFd:anIntegerOrHandle
  3131     "low level close of a filedescriptor"
  3131     "low level close of a filedescriptor"
  3132 
  3132 
  3133 %{
  3133 %{
  3134      if (__isExternalAddress(anInteger) ) {
  3134     if (__isExternalAddressLike(anIntegerOrHandle) ) {
  3135 	if( !CloseHandle( anInteger ) ) {
  3135        if( !CloseHandle( anIntegerOrHandle ) ) {
  3136 	    fprintf( stderr, "Could not close handle : %d\n", anInteger);
  3136 	   fprintf( stderr, "Could not close handle : %x\n", anIntegerOrHandle);
  3137 	}
  3137        }
       
  3138        RETURN(self);
       
  3139     }
       
  3140     if (__isSmallInteger(anIntegerOrHandle)) {
       
  3141 	close(__intVal(anIntegerOrHandle));
  3138 	RETURN(self);
  3142 	RETURN(self);
  3139      } else {
  3143     }
  3140 	if (__isSmallInteger(anInteger)) {
       
  3141 	    close(__intVal(anInteger));
       
  3142 	    RETURN(self);
       
  3143 	}
       
  3144      }
       
  3145 %}.
  3144 %}.
  3146      ^ self primitiveFailed.
  3145     ^ self primitiveFailed.
  3147 !
  3146 !
  3148 
  3147 
  3149 createDirectory:aPathName
  3148 createDirectory:aPathName
  3150     "create a new directory with name 'aPathName', which may be an absolute
  3149     "create a new directory with name 'aPathName', which may be an absolute
  3151      path, or relative to the current directory.
  3150      path, or relative to the current directory.
  4873 	 global data maintained by dynamic-link libraries (DLLs)
  4872 	 global data maintained by dynamic-link libraries (DLLs)
  4874 	 may be compromised if TerminateProcess is used.
  4873 	 may be compromised if TerminateProcess is used.
  4875      TODO: send it a WM_QUIT instead, to allow for proper shutdown."
  4874      TODO: send it a WM_QUIT instead, to allow for proper shutdown."
  4876 
  4875 
  4877 %{  
  4876 %{  
  4878     if (__isExternalAddress(processId) ) {
  4877     if (__isExternalAddressLike(processId) ) {
  4879 	HANDLE __pid = _HANDLEVal(processId);
  4878 	HANDLE __pid = _HANDLEVal(processId);
  4880 
  4879 
  4881 #ifdef PROCESS1DEBUGWIN32
  4880 #ifdef PROCESS1DEBUGWIN32
  4882 	printf("Terminate ProcessHandle %x\n", __pid);
  4881 	printf("Terminate ProcessHandle %x\n", __pid);
  4883 #endif
  4882 #endif
  4906 	 global data maintained by dynamic-link libraries (DLLs)
  4905 	 global data maintained by dynamic-link libraries (DLLs)
  4907 	 may be compromised if TerminateProcess is used.
  4906 	 may be compromised if TerminateProcess is used.
  4908      Not implemented - TODO: enumerate all sub-processes and terminate them all ..."
  4907      Not implemented - TODO: enumerate all sub-processes and terminate them all ..."
  4909 
  4908 
  4910 %{  
  4909 %{  
  4911     if (__isExternalAddress(processGroupId) ) {
  4910     if (__isExternalAddressLike(processGroupId) ) {
  4912 	HANDLE __pgid = _HANDLEVal(processGroupId);
  4911 	HANDLE __pgid = _HANDLEVal(processGroupId);
  4913 
  4912 
  4914 #ifdef PROCESS1DEBUGWIN32
  4913 #ifdef PROCESS1DEBUGWIN32
  4915 	printf("primTerminateProcessGroup ProcessHandle %x not yet implemented.\n", __pgid);
  4914 	printf("primTerminateProcessGroup ProcessHandle %x not yet implemented.\n", __pgid);
  4916 #endif
  4915 #endif
  4974 !Win32OperatingSystem class methodsFor:'misc'!
  4973 !Win32OperatingSystem class methodsFor:'misc'!
  4975 
  4974 
  4976 closePid:pid
  4975 closePid:pid
  4977     "free pid resource"
  4976     "free pid resource"
  4978 %{
  4977 %{
  4979     if (__isExternalAddress(pid) ) {
  4978     if (__isExternalAddressLike(pid) ) {
  4980 	if (_HANDLEVal(pid) != 0) {
  4979 	HANDLE __pid = _HANDLEVal(pid);
       
  4980 
       
  4981 	if (__pid != 0) {
  4981 #ifdef PROCESSDEBUGWIN32
  4982 #ifdef PROCESSDEBUGWIN32
  4982 	    printf("Close ProcessHandle %x\n",_HANDLEVal(pid));
  4983 	    printf("Close ProcessHandle %x\n", __pid);
  4983 #endif
  4984 #endif
  4984 	    CloseHandle(_HANDLEVal(pid));
  4985 	    CloseHandle(__pid);
  4985 	    _HANDLEVal(pid) = 0;
  4986 	    _HANDLEVal(pid) = 0;
  4986 	}
  4987 	}
  4987     }
  4988     }
  4988 %}.
  4989 %}.
  4989     ^ true.
  4990     ^ true.
  6993 
  6994 
  6994     |pid status code core|
  6995     |pid status code core|
  6995 %{
  6996 %{
  6996     DWORD endStatus;
  6997     DWORD endStatus;
  6997 
  6998 
  6998     if (__isExternalAddress(pidToWait) ) {
  6999     if (__isExternalAddressLike(pidToWait) ) {
  6999 	HANDLE __pidToWait = _HANDLEVal(pidToWait);
  7000 	HANDLE __pidToWait = _HANDLEVal(pidToWait);
  7000 	int t;
  7001 	int t;
  7001 
  7002 
  7002 #ifdef PROCESS1DEBUGWIN32
  7003 #ifdef PROCESS1DEBUGWIN32
  7003 	printf("childProcessWait %x b %d\n",__pidToWait,blocking==true); 
  7004 	printf("childProcessWait %x b %d\n",__pidToWait,blocking==true); 
  7112 	for (i=0; (i<count) && (numHandles < MAXHANDLE);i++) {
  7113 	for (i=0; (i<count) && (numHandles < MAXHANDLE);i++) {
  7113 	    fd = __ArrayInstPtr(readFdArray)->a_element[i];
  7114 	    fd = __ArrayInstPtr(readFdArray)->a_element[i];
  7114 	    if (fd != nil) {
  7115 	    if (fd != nil) {
  7115 		HANDLE h;
  7116 		HANDLE h;
  7116 
  7117 
  7117 		if (__isExternalAddress(fd)) {
  7118 		if (__isExternalAddressLike(fd)) {
  7118 		    hArray[numHandles] = h = _HANDLEVal(fd);
  7119 		    hArray[numHandles] = h = _HANDLEVal(fd);
  7119 		} else {
  7120 		} else {
  7120 		    hArray[numHandles] = h = (HANDLE) _get_osfhandle (__intVal(fd));
  7121 		    hArray[numHandles] = h = (HANDLE) _get_osfhandle (__intVal(fd));
  7121 
  7122 
  7122 		    if (ioctlsocket((SOCKET)h, FIONREAD, &res)==0) {
  7123 		    if (ioctlsocket((SOCKET)h, FIONREAD, &res)==0) {
  7165 	}
  7166 	}
  7166 	count = __arraySize(writeFdArray);
  7167 	count = __arraySize(writeFdArray);
  7167 	for (i=0; (i<count) && (numHandles < MAXHANDLE);i++) {
  7168 	for (i=0; (i<count) && (numHandles < MAXHANDLE);i++) {
  7168 	    fd = __ArrayInstPtr(writeFdArray)->a_element[i];
  7169 	    fd = __ArrayInstPtr(writeFdArray)->a_element[i];
  7169 	    if (fd != nil) {
  7170 	    if (fd != nil) {
  7170 		if (__isExternalAddress(fd)) {
  7171 		if (__isExternalAddressLike(fd)) {
  7171 		    hArray[numHandles]  = _HANDLEVal(fd);
  7172 		    hArray[numHandles]  = _HANDLEVal(fd);
  7172 		} else {
  7173 		} else {
  7173 		    hArray[numHandles] = (HANDLE) _get_osfhandle (__intVal(fd));
  7174 		    hArray[numHandles] = (HANDLE) _get_osfhandle (__intVal(fd));
  7174 		}
  7175 		}
  7175 #ifdef SELECTDEBUGWIN32
  7176 #ifdef SELECTDEBUGWIN32
  7187 	}
  7188 	}
  7188 	count = __arraySize(exceptFdArray);
  7189 	count = __arraySize(exceptFdArray);
  7189 	for (i=0; (i<count) && (numHandles < MAXHANDLE);i++) {
  7190 	for (i=0; (i<count) && (numHandles < MAXHANDLE);i++) {
  7190 	    fd = __ArrayInstPtr(exceptFdArray)->a_element[i];
  7191 	    fd = __ArrayInstPtr(exceptFdArray)->a_element[i];
  7191 	    if (fd != nil) {
  7192 	    if (fd != nil) {
  7192 		if (__isExternalAddress(fd)) {
  7193 		if (__isExternalAddressLike(fd)) {
  7193 		    hArray[numHandles]  = _HANDLEVal(fd);
  7194 		    hArray[numHandles]  = _HANDLEVal(fd);
  7194 		} else {
  7195 		} else {
  7195 		    hArray[numHandles] = (HANDLE) _get_osfhandle (__intVal(fd));
  7196 		    hArray[numHandles] = (HANDLE) _get_osfhandle (__intVal(fd));
  7196 		}
  7197 		}
  7197 #ifdef SELECTDEBUGWIN32
  7198 #ifdef SELECTDEBUGWIN32
  7285 	    }
  7286 	    }
  7286 	    count = __arraySize(readFdArray);
  7287 	    count = __arraySize(readFdArray);
  7287 	    for (i=0; (i<count);i++) {
  7288 	    for (i=0; (i<count);i++) {
  7288 		fd = __ArrayInstPtr(readFdArray)->a_element[i];
  7289 		fd = __ArrayInstPtr(readFdArray)->a_element[i];
  7289 		if (fd != nil) {
  7290 		if (fd != nil) {
  7290 		    if (__isExternalAddress(fd)) {
  7291 		    if (__isExternalAddressLike(fd)) {
  7291 			continue;
  7292 			continue;
  7292 		    } else {
  7293 		    } else {
  7293 			h = (HANDLE) _get_osfhandle (__intVal(fd));
  7294 			h = (HANDLE) _get_osfhandle (__intVal(fd));
  7294 
  7295 
  7295 			if (ioctlsocket((SOCKET)h, FIONREAD, &res)==0) {
  7296 			if (ioctlsocket((SOCKET)h, FIONREAD, &res)==0) {
  7361 
  7362 
  7362     for (i=0; i<count; i++) {
  7363     for (i=0; i<count; i++) {
  7363 	OBJ fdOrHandle = __ArrayInstPtr(fdOrHandleArray)->a_element[i];
  7364 	OBJ fdOrHandle = __ArrayInstPtr(fdOrHandleArray)->a_element[i];
  7364 	HANDLE h;
  7365 	HANDLE h;
  7365 
  7366 
  7366 	if (__isExternalAddress(fdOrHandle)) {
  7367 	if (__isExternalAddressLike(fdOrHandle)) {
  7367 	    h = _HANDLEVal(fdOrHandle);
  7368 	    h = _HANDLEVal(fdOrHandle);
  7368 	} else {
  7369 	} else {
  7369 	    if (__isSmallInteger(fdOrHandle)) {
  7370 	    if (__isSmallInteger(fdOrHandle)) {
  7370 		h = (HANDLE) _get_osfhandle (__intVal(fdOrHandle));
  7371 		h = (HANDLE) _get_osfhandle (__intVal(fdOrHandle));
  7371 	    } else {
  7372 	    } else {
  7421 %{
  7422 %{
  7422     INT t;
  7423     INT t;
  7423     DWORD res;
  7424     DWORD res;
  7424     HANDLE h = NULL;
  7425     HANDLE h = NULL;
  7425 
  7426 
  7426     if (__isExternalAddress(fdOrHandle)) {
  7427     if (__isExternalAddressLike(fdOrHandle)) {
  7427 	h = _HANDLEVal(fdOrHandle);
  7428 	h = _HANDLEVal(fdOrHandle);
  7428     } else {
  7429     } else {
  7429 	if (__isSmallInteger(fdOrHandle)) {
  7430 	if (__isSmallInteger(fdOrHandle)) {
  7430 	    h = (HANDLE) _get_osfhandle (__intVal(fdOrHandle));
  7431 	    h = (HANDLE) _get_osfhandle (__intVal(fdOrHandle));
  7431 	} else {
  7432 	} else {
  8169     |newEntry subHandle|
  8170     |newEntry subHandle|
  8170 
  8171 
  8171 %{
  8172 %{
  8172     HKEY myKey, subKey = 0;
  8173     HKEY myKey, subKey = 0;
  8173 
  8174 
  8174     if (__isExternalAddress(__INST(handle)) 
  8175     if (__isExternalAddressLike(__INST(handle)) 
  8175      && (__isString(subKeyString) || __isSymbol(subKeyString))) {
  8176      && (__isString(subKeyString) || __isSymbol(subKeyString))) {
  8176 	myKey = (HKEY)__externalAddressVal(__INST(handle));
  8177 	myKey = (HKEY)__externalAddressVal(__INST(handle));
  8177 	if (RegCreateKey(myKey, __stringVal(subKeyString), &subKey) == ERROR_SUCCESS) {
  8178 	if (RegCreateKey(myKey, __stringVal(subKeyString), &subKey) == ERROR_SUCCESS) {
  8178 	    subHandle = __MKEXTERNALADDRESS(subKey);
  8179 	    subHandle = __MKEXTERNALADDRESS(subKey);
  8179 	}
  8180 	}
  8201      Return true on success."
  8202      Return true on success."
  8202 
  8203 
  8203 %{
  8204 %{
  8204     HKEY myKey;
  8205     HKEY myKey;
  8205 
  8206 
  8206     if (__isExternalAddress(__INST(handle)) 
  8207     if (__isExternalAddressLike(__INST(handle)) 
  8207      && (__isString(subKeyString) || __isSymbol(subKeyString))) {
  8208      && (__isString(subKeyString) || __isSymbol(subKeyString))) {
  8208 	myKey = (HKEY)__externalAddressVal(__INST(handle));
  8209 	myKey = (HKEY)__externalAddressVal(__INST(handle));
  8209 	if (RegDeleteKey(myKey, __stringVal(subKeyString)) == ERROR_SUCCESS) {
  8210 	if (RegDeleteKey(myKey, __stringVal(subKeyString)) == ERROR_SUCCESS) {
  8210 	    RETURN (true);
  8211 	    RETURN (true);
  8211 	}
  8212 	}
  8229     |newEntry remoteHandle|
  8230     |newEntry remoteHandle|
  8230 
  8231 
  8231 %{
  8232 %{
  8232     HKEY myKey, remoteKey = 0;
  8233     HKEY myKey, remoteKey = 0;
  8233 
  8234 
  8234     if (__isExternalAddress(__INST(handle)) && __isString(hostName)) {
  8235     if (__isExternalAddressLike(__INST(handle)) && __isString(hostName)) {
  8235 	myKey = (HKEY)__externalAddressVal(__INST(handle));
  8236 	myKey = (HKEY)__externalAddressVal(__INST(handle));
  8236 	if (RegConnectRegistry(__stringVal(hostName), myKey, &remoteKey) == ERROR_SUCCESS) {
  8237 	if (RegConnectRegistry(__stringVal(hostName), myKey, &remoteKey) == ERROR_SUCCESS) {
  8237 	    remoteHandle = __MKEXTERNALADDRESS(remoteKey);
  8238 	    remoteHandle = __MKEXTERNALADDRESS(remoteKey);
  8238 	}
  8239 	}
  8239     }
  8240     }
  8284     DWORD nameSize = sizeof(nameBuffer) - 1;
  8285     DWORD nameSize = sizeof(nameBuffer) - 1;
  8285     char classNameBuffer[256];
  8286     char classNameBuffer[256];
  8286     DWORD classNameSize = sizeof(classNameBuffer) - 1;
  8287     DWORD classNameSize = sizeof(classNameBuffer) - 1;
  8287     FILETIME modificationTime;
  8288     FILETIME modificationTime;
  8288 
  8289 
  8289     if (__isExternalAddress(__INST(handle)) 
  8290     if (__isExternalAddressLike(__INST(handle)) 
  8290      && __isSmallInteger(subKeyIndex)) {
  8291      && __isSmallInteger(subKeyIndex)) {
  8291 	myKey = (HKEY)__externalAddressVal(__INST(handle));
  8292 	myKey = (HKEY)__externalAddressVal(__INST(handle));
  8292 	if (RegEnumKeyEx(myKey, __intVal(subKeyIndex), 
  8293 	if (RegEnumKeyEx(myKey, __intVal(subKeyIndex), 
  8293 			 nameBuffer, &nameSize,
  8294 			 nameBuffer, &nameSize,
  8294 			 NULL,
  8295 			 NULL,
  8320     |newEntry subHandle|
  8321     |newEntry subHandle|
  8321 
  8322 
  8322 %{
  8323 %{
  8323     HKEY myKey, subKey = 0;
  8324     HKEY myKey, subKey = 0;
  8324 
  8325 
  8325     if (__isExternalAddress(__INST(handle)) 
  8326     if (__isExternalAddressLike(__INST(handle)) 
  8326      && (__isString(subKeyString) || __isSymbol(subKeyString))) {
  8327      && (__isString(subKeyString) || __isSymbol(subKeyString))) {
  8327 	myKey = (HKEY)__externalAddressVal(__INST(handle));
  8328 	myKey = (HKEY)__externalAddressVal(__INST(handle));
  8328 	if (RegOpenKey(myKey, __stringVal(subKeyString), &subKey) == ERROR_SUCCESS) {
  8329 	if (RegOpenKey(myKey, __stringVal(subKeyString), &subKey) == ERROR_SUCCESS) {
  8329 	    subHandle = __MKEXTERNALADDRESS(subKey);
  8330 	    subHandle = __MKEXTERNALADDRESS(subKey);
  8330 	}
  8331 	}
  8354      Return true on success."
  8355      Return true on success."
  8355 
  8356 
  8356 %{
  8357 %{
  8357     HKEY myKey;
  8358     HKEY myKey;
  8358 
  8359 
  8359     if (__isExternalAddress(__INST(handle)) 
  8360     if (__isExternalAddressLike(__INST(handle)) 
  8360      && (__isString(aValueName) || __isSymbol(aValueName))) {
  8361      && (__isString(aValueName) || __isSymbol(aValueName))) {
  8361 	myKey = (HKEY)__externalAddressVal(__INST(handle));
  8362 	myKey = (HKEY)__externalAddressVal(__INST(handle));
  8362 	if (RegDeleteValue(myKey, __stringVal(aValueName)) == ERROR_SUCCESS) {
  8363 	if (RegDeleteValue(myKey, __stringVal(aValueName)) == ERROR_SUCCESS) {
  8363 	    RETURN (true);
  8364 	    RETURN (true);
  8364 	}
  8365 	}
  8377     HKEY myKey;
  8378     HKEY myKey;
  8378     char nameBuffer[256];
  8379     char nameBuffer[256];
  8379     DWORD nameSize = sizeof(nameBuffer) - 1;
  8380     DWORD nameSize = sizeof(nameBuffer) - 1;
  8380     DWORD valueType;
  8381     DWORD valueType;
  8381 
  8382 
  8382     if (__isExternalAddress(__INST(handle)) 
  8383     if (__isExternalAddressLike(__INST(handle)) 
  8383      && __isSmallInteger(valueIndex)) {
  8384      && __isSmallInteger(valueIndex)) {
  8384 	myKey = (HKEY)__externalAddressVal(__INST(handle));
  8385 	myKey = (HKEY)__externalAddressVal(__INST(handle));
  8385 	if (RegEnumValue(myKey, __intVal(valueIndex), 
  8386 	if (RegEnumValue(myKey, __intVal(valueIndex), 
  8386 			 nameBuffer, &nameSize,
  8387 			 nameBuffer, &nameSize,
  8387 			 NULL,
  8388 			 NULL,
  8422     } quickData;
  8423     } quickData;
  8423     int val;
  8424     int val;
  8424     DWORD dataSize = sizeof(quickData);
  8425     DWORD dataSize = sizeof(quickData);
  8425     unsigned char *dataBuffer = NULL;
  8426     unsigned char *dataBuffer = NULL;
  8426 
  8427 
  8427     if (__isExternalAddress(__INST(handle)) 
  8428     if (__isExternalAddressLike(__INST(handle)) 
  8428      && (__isString(aValueName) || __isSymbol(aValueName))) {
  8429      && (__isString(aValueName) || __isSymbol(aValueName))) {
  8429 	int ret;
  8430 	int ret;
  8430 
  8431 
  8431 	myKey = (HKEY)__externalAddressVal(__INST(handle));
  8432 	myKey = (HKEY)__externalAddressVal(__INST(handle));
  8432 
  8433 
  8564     int val;
  8565     int val;
  8565     DWORD dataSize = -1;
  8566     DWORD dataSize = -1;
  8566     unsigned char *dataPointer = NULL;
  8567     unsigned char *dataPointer = NULL;
  8567     int datumOk = 1, mustFreeData = 0;
  8568     int datumOk = 1, mustFreeData = 0;
  8568 
  8569 
  8569     if (__isExternalAddress(__INST(handle)) 
  8570     if (__isExternalAddressLike(__INST(handle)) 
  8570      && (__isString(aValueName) || __isSymbol(aValueName))) {
  8571      && (__isString(aValueName) || __isSymbol(aValueName))) {
  8571 	int ret;
  8572 	int ret;
  8572 	OBJ cls;
  8573 	OBJ cls;
  8573 
  8574 
  8574 	myKey = (HKEY)__externalAddressVal(__INST(handle));
  8575 	myKey = (HKEY)__externalAddressVal(__INST(handle));
  8786     "close mySelf"
  8787     "close mySelf"
  8787 
  8788 
  8788 %{
  8789 %{
  8789     HKEY myKey;
  8790     HKEY myKey;
  8790 
  8791 
  8791     if (__isExternalAddress(__INST(handle))) {
  8792     if (__isExternalAddressLike(__INST(handle))) {
  8792 	myKey = (HKEY)(__externalAddressVal(__INST(handle)));
  8793 	myKey = (HKEY)(__externalAddressVal(__INST(handle)));
  8793 	__INST(handle) = nil;
  8794 	__INST(handle) = nil;
  8794 	RegCloseKey(myKey);
  8795 	RegCloseKey(myKey);
  8795     }
  8796     }
  8796 %}
  8797 %}
  8848     libraries...
  8849     libraries...
  8849 "
  8850 "
  8850 !
  8851 !
  8851 
  8852 
  8852 version
  8853 version
  8853     ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.134 2003-10-09 15:20:56 cg Exp $'
  8854     ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.135 2003-10-12 12:30:18 cg Exp $'
  8854 ! !
  8855 ! !
  8855 
  8856 
  8856 !Win32OperatingSystem::Win32FILEHandle methodsFor:'release'!
  8857 !Win32OperatingSystem::Win32FILEHandle methodsFor:'release'!
  8857 
  8858 
  8858 closeFile
  8859 closeFile
  8875     I represent a generic HANDLE, which can be closed via CloseHandle.
  8876     I represent a generic HANDLE, which can be closed via CloseHandle.
  8876 "
  8877 "
  8877 !
  8878 !
  8878 
  8879 
  8879 version
  8880 version
  8880     ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.134 2003-10-09 15:20:56 cg Exp $'
  8881     ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.135 2003-10-12 12:30:18 cg Exp $'
  8881 ! !
  8882 ! !
  8882 
  8883 
  8883 !Win32OperatingSystem::Win32Handle methodsFor:'io'!
  8884 !Win32OperatingSystem::Win32Handle methodsFor:'io'!
  8884 
  8885 
  8885 readBytes:count into:aByteBuffer startingAt:firstIndex
  8886 readBytes:count into:aByteBuffer startingAt:firstIndex
  9262 ! !
  9263 ! !
  9263 
  9264 
  9264 !Win32OperatingSystem class methodsFor:'documentation'!
  9265 !Win32OperatingSystem class methodsFor:'documentation'!
  9265 
  9266 
  9266 version
  9267 version
  9267     ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.134 2003-10-09 15:20:56 cg Exp $'
  9268     ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.135 2003-10-12 12:30:18 cg Exp $'
  9268 ! !
  9269 ! !
  9269 
  9270 
  9270 Win32OperatingSystem initialize!
  9271 Win32OperatingSystem initialize!
  9271 Win32OperatingSystem::RegistryEntry initialize!
  9272 Win32OperatingSystem::RegistryEntry initialize!