Win32OperatingSystem.st
changeset 9093 cba833917516
parent 9092 286c8b9e8780
child 9094 c4d084167915
equal deleted inserted replaced
9092:286c8b9e8780 9093:cba833917516
    51 	privateIn:Win32OperatingSystem
    51 	privateIn:Win32OperatingSystem
    52 !
    52 !
    53 
    53 
    54 OSFileHandle subclass:#Win32Handle
    54 OSFileHandle subclass:#Win32Handle
    55 	instanceVariableNames:''
    55 	instanceVariableNames:''
    56 	classVariableNames:''
    56 	classVariableNames:'Lobby'
    57 	poolDictionaries:''
    57 	poolDictionaries:''
    58 	privateIn:Win32OperatingSystem
    58 	privateIn:Win32OperatingSystem
    59 !
    59 !
    60 
    60 
    61 Win32OperatingSystem::Win32Handle subclass:#Win32ProcessHandle
    61 Win32OperatingSystem::Win32Handle subclass:#Win32ProcessHandle
   102 #if WINVER < 0x0400
   102 #if WINVER < 0x0400
   103 # define NO_GETADAPTERSINFO
   103 # define NO_GETADAPTERSINFO
   104 #endif
   104 #endif
   105 
   105 
   106 #define WANT_OLE
   106 #define WANT_OLE
       
   107 #define OLE_DEBUG
   107 #define USE_H_ERRNO
   108 #define USE_H_ERRNO
   108 
   109 
   109 # if defined(i386) || defined(__i386__)
   110 # if defined(i386) || defined(__i386__)
   110 #  ifndef _X86_
   111 #  ifndef _X86_
   111 #   define _X86_
   112 #   define _X86_
   197 # ifndef NO_GETADAPTERSINFO
   198 # ifndef NO_GETADAPTERSINFO
   198 #  include <iphlpapi.h>
   199 #  include <iphlpapi.h>
   199 # endif
   200 # endif
   200 
   201 
   201 # ifdef WANT_OLE
   202 # ifdef WANT_OLE
       
   203 
   202 #  ifndef OLEAUTO_H_INCLUDED
   204 #  ifndef OLEAUTO_H_INCLUDED
   203 #   define OLEAUTO_H_INCLUDED
   205 #   define OLEAUTO_H_INCLUDED
   204 #   include <oleauto.h>
   206 #   include <oleauto.h>
   205 #  endif
   207 #  endif
       
   208 
   206 # endif
   209 # endif
   207 
   210 
   208 # if !defined(__BORLANDC__)
   211 # if !defined(__BORLANDC__)
   209 #  undef stat
   212 #  undef stat
   210 #  define stat _stat
   213 #  define stat _stat
  6745     ^ OSProcessStatus
  6748     ^ OSProcessStatus
  6746 
  6749 
  6747     "Created: / 12.6.1998 / 16:30:43 / cg"
  6750     "Created: / 12.6.1998 / 16:30:43 / cg"
  6748 ! !
  6751 ! !
  6749 
  6752 
  6750 !Win32OperatingSystem class methodsFor:'registry access'!
  6753 !Win32OperatingSystem class methodsFor:'registry support'!
  6751 
  6754 
  6752 registryEntry
  6755 registryEntry
  6753     "provide access to the registryEntry class"
  6756     "provide access to the registryEntry class"
  6754 
  6757 
  6755     ^ RegistryEntry
  6758     ^ RegistryEntry
  6756 ! !
  6759 ! !
  6757 
  6760 
  6758 !Win32OperatingSystem class methodsFor:'serial port support'!
  6761 !Win32OperatingSystem class methodsFor:'serial port support'!
  6759 
  6762 
  6760 serialPortAccessor
  6763 serialPortAccessor
       
  6764     "provide access to the serial port class"
       
  6765 
  6761     ^ Win32SerialPortHandle
  6766     ^ Win32SerialPortHandle
  6762 ! !
  6767 ! !
  6763 
  6768 
  6764 !Win32OperatingSystem class methodsFor:'socket creation'!
  6769 !Win32OperatingSystem class methodsFor:'ole/com support'!
       
  6770 
       
  6771 typeLibraryAccessor
       
  6772     "provide access to the type library class"
       
  6773 
       
  6774     ^ Win32TypeLibraryHandle
       
  6775 ! !
       
  6776 
       
  6777 !Win32OperatingSystem class methodsFor:'socket support'!
  6765 
  6778 
  6766 socketAccessor
  6779 socketAccessor
       
  6780     "provide access to the socket handle class"
       
  6781 
  6767     ^ Win32SocketHandle
  6782     ^ Win32SocketHandle
  6768 ! !
  6783 ! !
  6769 
  6784 
  6770 !Win32OperatingSystem class methodsFor:'system management'!
  6785 !Win32OperatingSystem class methodsFor:'system management'!
  6771 
  6786 
  9529     libraries...
  9544     libraries...
  9530 "
  9545 "
  9531 !
  9546 !
  9532 
  9547 
  9533 version
  9548 version
  9534     ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.194 2006-02-06 15:30:48 cg Exp $'
  9549     ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.195 2006-02-06 21:35:13 cg Exp $'
  9535 ! !
  9550 ! !
  9536 
  9551 
  9537 !Win32OperatingSystem::Win32FILEHandle methodsFor:'release'!
  9552 !Win32OperatingSystem::Win32FILEHandle methodsFor:'release'!
  9538 
  9553 
  9539 closeFile
  9554 closeFile
  9556     I represent a generic HANDLE, which can be closed via CloseHandle.
  9571     I represent a generic HANDLE, which can be closed via CloseHandle.
  9557 "
  9572 "
  9558 !
  9573 !
  9559 
  9574 
  9560 version
  9575 version
  9561     ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.194 2006-02-06 15:30:48 cg Exp $'
  9576     ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.195 2006-02-06 21:35:13 cg Exp $'
       
  9577 ! !
       
  9578 
       
  9579 !Win32OperatingSystem::Win32Handle class methodsFor:'initialization'!
       
  9580 
       
  9581 initialize
       
  9582     Lobby := Registry new.
  9562 ! !
  9583 ! !
  9563 
  9584 
  9564 !Win32OperatingSystem::Win32Handle methodsFor:'io'!
  9585 !Win32OperatingSystem::Win32Handle methodsFor:'io'!
  9565 
  9586 
  9566 readBytes:count into:aByteBuffer startingAt:firstIndex
  9587 readBytes:count into:aByteBuffer startingAt:firstIndex
 10291 loadTypeLib:pathName
 10312 loadTypeLib:pathName
 10292     |errorNumber newHandle|
 10313     |errorNumber newHandle|
 10293 %{
 10314 %{
 10294 #ifdef WANT_OLE
 10315 #ifdef WANT_OLE
 10295     if ( __isString(pathName) ) {
 10316     if ( __isString(pathName) ) {
       
 10317 	OLECHAR __olePathName[MAX_PATH+1];
 10296 	char *__pathName = __stringVal(pathName);
 10318 	char *__pathName = __stringVal(pathName);
 10297 	HANDLE hTypeLib = 0;
 10319 	ITypeLib *hTypeLib;
 10298 	int rslt;
 10320 	HRESULT rslt;
 10299 
 10321 
 10300 	rslt = LoadTypeLib(__pathName, &hTypeLib);
 10322 	{
 10301 	fprintf(stderr, "rslt: %d handle: %x\n", rslt, hTypeLib);
 10323 	    int i = 0;
 10302 	if (hTypeLib) {
 10324 	    char *cp;
 10303 	    newHandle = __MKEXTERNALADDRESS(hTypeLib);
 10325 
 10304 	    __qClass(newHandle) = self;
 10326 	    for (cp = __pathName; i<MAX_PATH; i++) {
 10305 	    __STORE(newHandle, self);
 10327 		__olePathName[i] = cp[i];
 10306 	} else {
 10328 		if (cp[i] == 0) break;
 10307 	    errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
 10329 	    }
       
 10330 	    __olePathName[MAX_PATH] = 0;
       
 10331 	}
       
 10332 	rslt = LoadTypeLib(__olePathName, &hTypeLib);
       
 10333 # ifdef OLE_DEBUG
       
 10334 	fprintf(stderr, "rslt: %d (%x) handle: %x\n", rslt, rslt, hTypeLib);
       
 10335 # endif
       
 10336 	switch (rslt) {
       
 10337 	    case S_OK:
       
 10338 		if (hTypeLib) {
       
 10339 		    newHandle = __MKEXTERNALADDRESS(hTypeLib);
       
 10340 		    __qClass(newHandle) = self;
       
 10341 		    __STORE(newHandle, self);
       
 10342 		} else {
       
 10343 		    errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
       
 10344 		}
       
 10345 		break;
       
 10346 
       
 10347 # ifdef OLE_DEBUG
       
 10348 	    case E_OUTOFMEMORY:
       
 10349 		fprintf(stderr, "Out of memory\n");
       
 10350 		break;
       
 10351 
       
 10352 	    case E_INVALIDARG:
       
 10353 		fprintf(stderr, "One or more arguments is invalid\n");
       
 10354 		break;
       
 10355 
       
 10356 	    case TYPE_E_IOERROR:
       
 10357 		fprintf(stderr, "The function could not write to the file\n");
       
 10358 		break;
       
 10359 
       
 10360 	    case TYPE_E_INVALIDSTATE:
       
 10361 		fprintf(stderr, "The type library could not be opened\n");
       
 10362 		break;
       
 10363 
       
 10364 	    case TYPE_E_INVDATAREAD:
       
 10365 		fprintf(stderr, "The function could not read from the file\n");
       
 10366 		break;
       
 10367 
       
 10368 	    case TYPE_E_UNSUPFORMAT:
       
 10369 		fprintf(stderr, "The type library has an older format\n");
       
 10370 		break;
       
 10371 
       
 10372 	    case TYPE_E_UNKNOWNLCID:
       
 10373 		fprintf(stderr, "The LCID could not be found in the OLE-supported DLLs\n");
       
 10374 		break;
       
 10375 
       
 10376 	    case TYPE_E_CANTLOADLIBRARY:
       
 10377 		fprintf(stderr, "The type library or DLL could not be loaded\n");
       
 10378 		break;
       
 10379 
       
 10380 	    default:
       
 10381 		fprintf(stderr, "other error\n");
       
 10382 		break;
       
 10383 # endif /* OLE_DEBUG */
 10308 	}
 10384 	}
 10309     }
 10385     }
 10310 #endif /* WANT_OLE */
 10386 #endif /* WANT_OLE */
 10311 %}.
 10387 %}.
 10312     newHandle notNil ifTrue:[
 10388     newHandle notNil ifTrue:[
 10957 ! !
 11033 ! !
 10958 
 11034 
 10959 !Win32OperatingSystem class methodsFor:'documentation'!
 11035 !Win32OperatingSystem class methodsFor:'documentation'!
 10960 
 11036 
 10961 version
 11037 version
 10962     ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.194 2006-02-06 15:30:48 cg Exp $'
 11038     ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.195 2006-02-06 21:35:13 cg Exp $'
 10963 ! !
 11039 ! !
 10964 
 11040 
 10965 Win32OperatingSystem initialize!
 11041 Win32OperatingSystem initialize!
 10966 Win32OperatingSystem::RegistryEntry initialize!
 11042 Win32OperatingSystem::RegistryEntry initialize!