changeset 7852 | 5e0c389a8164 |
parent 7850 | 087b4ca01736 |
child 7860 | d08a47772aa1 |
7851:b53ad9abf79c | 7852:5e0c389a8164 |
---|---|
66 ! |
66 ! |
67 |
67 |
68 !Win32OperatingSystem primitiveDefinitions! |
68 !Win32OperatingSystem primitiveDefinitions! |
69 %{ |
69 %{ |
70 |
70 |
71 /* |
|
72 * if DO_WRAP_CALLS is not defined, API-calls are performed directly |
|
73 * if it is, they are performed by another thread. |
|
74 * The system does not work correctly without wrapCalls. |
|
75 */ |
|
71 # ifndef DO_WRAP_CALLS |
76 # ifndef DO_WRAP_CALLS |
72 # define STX_C_CALL0(__nm__, __f__) __f__((__a1__)) |
77 # define STX_C_CALL0(__nm__, __f__) __f__( ) |
73 # define STX_C_CALL1(__nm__, __f__, __a1__) __f__((__a1__)) |
78 # define STX_C_CALL1(__nm__, __f__, __a1__) __f__((__a1__)) |
74 # define STX_C_CALL2(__nm__, __f__, __a1__, __a2__) __f__((__a1__), (__a2__)) |
79 # define STX_C_CALL2(__nm__, __f__, __a1__, __a2__) __f__((__a1__), (__a2__)) |
75 # define STX_C_CALL3(__nm__, __f__, __a1__, __a2__, __a3__) __f__((__a1__), (__a2__), (__a3__)) |
80 # define STX_C_CALL3(__nm__, __f__, __a1__, __a2__, __a3__) __f__((__a1__), (__a2__), (__a3__)) |
76 # define STX_API_CALL0(__nm__, __f__) __f__((__a1__)) |
81 # define STX_API_CALL0(__nm__, __f__) __f__( ) |
77 # define STX_API_CALL1(__nm__, __f__, __a1__) __f__((__a1__)) |
82 # define STX_API_CALL1(__nm__, __f__, __a1__) __f__((__a1__)) |
78 # define STX_API_CALL2(__nm__, __f__, __a1__, __a2__) __f__((__a1__), (__a2__)) |
83 # define STX_API_CALL2(__nm__, __f__, __a1__, __a2__) __f__((__a1__), (__a2__)) |
79 # define STX_API_CALL3(__nm__, __f__, __a1__, __a2__, __a3__) __f__((__a1__), (__a2__), (__a3__)) |
84 # define STX_API_CALL3(__nm__, __f__, __a1__, __a2__, __a3__) __f__((__a1__), (__a2__), (__a3__)) |
80 # define STX_API_CALL4(__nm__, __f__, __a1__, __a2__, __a3__, __a4__) __f__((__a1__), (__a2__), (__a3__), (__a4__)) |
85 # define STX_API_CALL4(__nm__, __f__, __a1__, __a2__, __a3__, __a4__) __f__((__a1__), (__a2__), (__a3__), (__a4__)) |
86 # define STX_API_CALL5(__nm__, __f__, __a1__, __a2__, __a3__, __a4__, __a5__) __f__((__a1__), (__a2__), (__a3__), (__a4__), (__a5__)) |
|
81 # else |
87 # else |
82 # define STX_C_CALL0(__nm__, __f__) __STX_C_CALL0(__nm__, (void*)__f__) |
88 # define STX_C_CALL0(__nm__, __f__) __STX_C_CALL0(__nm__, (void*)__f__) |
83 # define STX_C_CALL1(__nm__, __f__, __a1__) __STX_C_CALL1(__nm__, (void*)__f__, (void*)(__a1__)) |
89 # define STX_C_CALL1(__nm__, __f__, __a1__) __STX_C_CALL1(__nm__, (void*)__f__, (void*)(__a1__)) |
84 # define STX_C_CALL2(__nm__, __f__, __a1__, __a2__) __STX_C_CALL2(__nm__, (void*)__f__, (void*)(__a1__), (void*)(__a2__)) |
90 # define STX_C_CALL2(__nm__, __f__, __a1__, __a2__) __STX_C_CALL2(__nm__, (void*)__f__, (void*)(__a1__), (void*)(__a2__)) |
85 # define STX_C_CALL3(__nm__, __f__, __a1__, __a2__, __a3__) __STX_C_CALL3(__nm__, (void*)__f__, (void*)(__a1__), (void*)(__a2__), (void*)(__a3__)) |
91 # define STX_C_CALL3(__nm__, __f__, __a1__, __a2__, __a3__) __STX_C_CALL3(__nm__, (void*)__f__, (void*)(__a1__), (void*)(__a2__), (void*)(__a3__)) |
86 # define STX_API_CALL0(__nm__, __f__) __STX_API_CALL0(__nm__, (void*)__f__) |
92 # define STX_API_CALL0(__nm__, __f__) __STX_API_CALL0(__nm__, (void*)__f__) |
87 # define STX_API_CALL1(__nm__, __f__, __a1__) __STX_API_CALL1(__nm__, (void*)__f__, (void*)(__a1__)) |
93 # define STX_API_CALL1(__nm__, __f__, __a1__) __STX_API_CALL1(__nm__, (void*)__f__, (void*)(__a1__)) |
88 # define STX_API_CALL2(__nm__, __f__, __a1__, __a2__) __STX_API_CALL2(__nm__, (void*)__f__, (void*)(__a1__), (void*)(__a2__)) |
94 # define STX_API_CALL2(__nm__, __f__, __a1__, __a2__) __STX_API_CALL2(__nm__, (void*)__f__, (void*)(__a1__), (void*)(__a2__)) |
89 # define STX_API_CALL3(__nm__, __f__, __a1__, __a2__, __a3__) __STX_API_CALL3(__nm__, (void*)__f__, (void*)(__a1__), (void*)(__a2__), (void*)(__a3__)) |
95 # define STX_API_CALL3(__nm__, __f__, __a1__, __a2__, __a3__) __STX_API_CALL3(__nm__, (void*)__f__, (void*)(__a1__), (void*)(__a2__), (void*)(__a3__)) |
90 # define STX_API_CALL4(__nm__, __f__, __a1__, __a2__, __a3__, __a4__) __STX_API_CALL4(__nm__, (void*)__f__, (void*)(__a1__), (void*)(__a2__), (void*)(__a3__), (void*)(__a4__)) |
96 # define STX_API_CALL4(__nm__, __f__, __a1__, __a2__, __a3__, __a4__) __STX_API_CALL4(__nm__, (void*)__f__, (void*)(__a1__), (void*)(__a2__), (void*)(__a3__), (void*)(__a4__)) |
97 # define STX_API_CALL5(__nm__, __f__, __a1__, __a2__, __a3__, __a4__, __a5__) __STX_API_CALL5(__nm__, (void*)__f__, (void*)(__a1__), (void*)(__a2__), (void*)(__a3__), (void*)(__a4__), (void*)(__a5__)) |
|
91 # endif |
98 # endif |
92 |
99 |
93 # ifndef MSDOS_LIKE |
100 # ifndef MSDOS_LIKE /* windows is not a real operating system */ |
94 # define MSDOS_LIKE |
101 # define MSDOS_LIKE |
95 # endif |
102 # endif |
96 # undef UNIX_LIKE /* oops - we were too optimistic - no OS */ |
103 # undef UNIX_LIKE |
97 |
104 |
98 # ifdef i386 |
105 # ifdef i386 |
99 # ifndef _X86_ |
106 # ifndef _X86_ |
100 # define _X86_ |
107 # define _X86_ |
101 # endif |
108 # endif |
105 * notice: although many systems' include files |
112 * notice: although many systems' include files |
106 * already block against multiple inclusion, some |
113 * already block against multiple inclusion, some |
107 * do not. Therefore, this is done here again. |
114 * do not. Therefore, this is done here again. |
108 * (it does not hurt) |
115 * (it does not hurt) |
109 */ |
116 */ |
110 |
|
111 # ifndef _SIGNAL_H_INCLUDED_ |
117 # ifndef _SIGNAL_H_INCLUDED_ |
112 # include <signal.h> |
118 # include <signal.h> |
113 # define _SIGNAL_H_INCLUDED_ |
119 # define _SIGNAL_H_INCLUDED_ |
114 # endif |
120 # endif |
115 |
121 |
146 # ifndef _FCNTL_H_INCLUDED_ |
152 # ifndef _FCNTL_H_INCLUDED_ |
147 # include <fcntl.h> |
153 # include <fcntl.h> |
148 # define _FCNTL_H_INCLUDED_ |
154 # define _FCNTL_H_INCLUDED_ |
149 # endif |
155 # endif |
150 |
156 |
151 /*# define PROCESSDEBUGWIN32 /* */ |
157 /* # define PROCESSDEBUGWIN32 /* */ |
152 /*# define PROCESS1DEBUGWIN32 /* */ |
158 /* # define PROCESS1DEBUGWIN32 /* */ |
153 /*# define PROCESS2DEBUGWIN32 /* */ |
159 /* # define PROCESS2DEBUGWIN32 /* */ |
154 /* # define SELECTDEBUGWIN32 /* */ |
160 /* # define SELECTDEBUGWIN32 /* */ |
155 /* # define SELECT1DEBUGWIN32 /* */ |
161 /* # define SELECT1DEBUGWIN32 /* */ |
156 /* # define SELECT2DEBUGWIN32 /* */ |
162 /* # define SELECT2DEBUGWIN32 /* */ |
157 /* # define WAITDEBUGWIN32 /* */ |
163 /* # define WAITDEBUGWIN32 /* */ |
158 /* # define SIGNALDEBUGWIN32 /* */ |
164 /* # define SIGNALDEBUGWIN32 /* */ |
165 |
|
159 # undef INT |
166 # undef INT |
160 # undef Array |
167 # undef Array |
161 # undef Number |
168 # undef Number |
162 # undef Method |
169 # undef Method |
163 # undef Point |
170 # undef Point |
322 |
329 |
323 # if defined(HAS_SYSINFO) |
330 # if defined(HAS_SYSINFO) |
324 # include <sys/systeminfo.h> |
331 # include <sys/systeminfo.h> |
325 # endif |
332 # endif |
326 |
333 |
327 /* |
|
328 * some (old ?) systems do not define this ... |
|
329 */ |
|
330 #if !defined(R_OK) && !defined(_AIX) |
|
331 # define R_OK 4 /* Test for Read permission */ |
|
332 # define W_OK 2 /* Test for Write permission */ |
|
333 # define X_OK 1 /* Test for eXecute permission */ |
|
334 # define F_OK 0 /* Test for existence of File */ |
|
335 #endif |
|
336 |
|
337 #define SIGHANDLER_ARG int |
334 #define SIGHANDLER_ARG int |
338 |
335 |
339 #define _HANDLEVal(o) (HANDLE)(__externalAddressVal(o)) |
336 #define _HANDLEVal(o) (HANDLE)(__externalAddressVal(o)) |
340 |
337 |
341 /* |
338 /* |
372 ! ! |
369 ! ! |
373 |
370 |
374 !Win32OperatingSystem primitiveFunctions! |
371 !Win32OperatingSystem primitiveFunctions! |
375 %{ |
372 %{ |
376 |
373 |
374 /* isWindows-NT flag: |
|
375 * 1 for NT based systemes, such as NT,XP or 2k |
|
376 * 0 for w95 based systems, such as w95/w98/ME |
|
377 */ |
|
377 static int __isWinNT = 0; |
378 static int __isWinNT = 0; |
378 |
379 |
379 #define __wait wait |
380 #define __wait wait |
380 |
381 |
381 |
382 |
382 static int _canAccessIOWithoutBlocking (aFD, readMode) |
383 static int |
384 _canAccessIOWithoutBlocking (aFD, readMode) |
|
383 int aFD; |
385 int aFD; |
384 int readMode; |
386 int readMode; |
385 { |
387 { |
386 struct timeval tv; |
388 struct timeval tv; |
387 fd_set fds; |
389 fd_set fds; |
449 !Win32OperatingSystem class methodsFor:'documentation'! |
451 !Win32OperatingSystem class methodsFor:'documentation'! |
450 |
452 |
451 copyright |
453 copyright |
452 " |
454 " |
453 COPYRIGHT (c) 1988 by Claus Gittinger |
455 COPYRIGHT (c) 1988 by Claus Gittinger |
454 COPYRIGHT (c) 1998 by eXept Software AG |
456 COPYRIGHT (c) 1998-2004 by eXept Software AG |
455 All Rights Reserved |
457 All Rights Reserved |
456 |
458 |
457 This software is furnished under a license and may be used |
459 This software is furnished under a license and may be used |
458 only in accordance with the terms of that license and with the |
460 only in accordance with the terms of that license and with the |
459 inclusion of the above copyright notice. This software may not |
461 inclusion of the above copyright notice. This software may not |
463 " |
465 " |
464 ! |
466 ! |
465 |
467 |
466 documentation |
468 documentation |
467 " |
469 " |
468 NOTICE: this is being developed; |
|
469 this class resulted from extracting WIN32 specifics of the old |
470 this class resulted from extracting WIN32 specifics of the old |
470 OperatingSystemClass into this sub-class. |
471 OperatingSystemClass into this sub-class. |
471 You may find some leftover unix stuff, which will go away sooner |
472 You may find some leftover unix stuff, which will go away sooner |
472 or later. |
473 or later. |
473 |
474 |
571 ! ! |
572 ! ! |
572 |
573 |
573 !Win32OperatingSystem class methodsFor:'initialization'! |
574 !Win32OperatingSystem class methodsFor:'initialization'! |
574 |
575 |
575 initOSType |
576 initOSType |
576 "internal - see if running under win-NT |
577 "internal - see if running under win-NT/XP/2k |
577 (as opposed to win-95)" |
578 (as opposed to win-95/98/ME)" |
578 |
579 |
579 %{ /* NOCONTEXT */ |
580 %{ /* NOCONTEXT */ |
580 OSVERSIONINFO osvi; |
581 OSVERSIONINFO osvi; |
581 |
582 |
582 memset(&osvi, 0, sizeof(OSVERSIONINFO)); |
583 memset(&osvi, 0, sizeof(OSVERSIONINFO)); |
2759 |
2760 |
2760 exec:aCommandPath withArguments:argString environment:environment fileDescriptors:fdArray fork:doFork newPgrp:newPgrp inDirectory:aDirectory |
2761 exec:aCommandPath withArguments:argString environment:environment fileDescriptors:fdArray fork:doFork newPgrp:newPgrp inDirectory:aDirectory |
2761 "Internal lowLevel entry for combined fork & exec for WIN32 |
2762 "Internal lowLevel entry for combined fork & exec for WIN32 |
2762 |
2763 |
2763 If fork is false (chain a command): |
2764 If fork is false (chain a command): |
2764 execute the OS command specified by the argument, aCommandPath, with |
2765 execute the OS command specified by the argument, aCommandPath, with |
2765 arguments in argArray (no arguments, if nil). |
2766 arguments in argArray (no arguments, if nil). |
2766 If successful, this method does not return and smalltalk is gone. |
2767 If successful, this method does not return and smalltalk is gone. |
2767 If not successful, it does return. |
2768 If not successful, it does return. |
2768 Normal use is with forkForCommand. |
2769 Normal use is with forkForCommand. |
2769 |
2770 |
2770 If fork is true (subprocess command execution): |
2771 If fork is true (subprocess command execution): |
2771 fork a child to do the above. |
2772 fork a child to do the above. |
2772 The process id of the child process is returned; nil if the fork failed. |
2773 The process id of the child process is returned; nil if the fork failed. |
2773 |
2774 |
2774 fdArray contains the filedescriptors, to be used for the child (if fork is true). |
2775 fdArray contains the filedescriptors, to be used for the child (if fork is true). |
2775 fdArray[1] = 15 -> use fd 15 as stdin. |
2776 fdArray[1] = 15 -> use fd 15 as stdin. |
2776 If an element of the array is set to nil, the corresponding filedescriptor |
2777 If an element of the array is set to nil, the corresponding filedescriptor |
2777 will be closed for the child. |
2778 will be closed for the child. |
2778 fdArray[0] == StdIn for child |
2779 fdArray[0] == StdIn for child |
2779 fdArray[1] == StdOut for child |
2780 fdArray[1] == StdOut for child |
2780 fdArray[2] == StdErr for child |
2781 fdArray[2] == StdErr for child |
2781 on VMS, these must be channels as returned by createMailBox. |
2782 on VMS, these must be channels as returned by createMailBox. |
2782 |
2783 |
2783 NOTE that in WIN32 the fds are HANDLES. |
2784 NOTE that in WIN32 the fds are HANDLES. |
2784 |
2785 |
2785 If newPgrp is true, the subprocess will be established in a new process group. |
2786 If newPgrp is true, the subprocess will be established in a new process group. |
2786 The processgroup will be equal to id. |
2787 The processgroup will be equal to id. |
2787 newPgrp is not used on WIN32 and VMS systems." |
2788 newPgrp is not used on WIN32 and VMS systems." |
2788 |
2789 |
2789 |dirPath cmdPath cmdLine rslt| |
2790 |dirPath cmdPath cmdLine rslt| |
2790 |
2791 |
2791 aDirectory notNil ifTrue:[ |
2792 aDirectory notNil ifTrue:[ |
2792 dirPath := aDirectory asFilename asAbsoluteFilename osNameForDirectory. |
2793 dirPath := aDirectory asFilename asAbsoluteFilename osNameForDirectory. |
2793 (dirPath endsWith:':') ifTrue:[ |
2794 (dirPath endsWith:':') ifTrue:[ |
2794 dirPath := dirPath , '\'. |
2795 dirPath := dirPath , '\'. |
2795 ]. |
2796 ]. |
2796 ]. |
2797 ]. |
2797 |
2798 |
2798 self isMSWINDOWSNTlike ifTrue:[ |
2799 self isMSWINDOWSNTlike ifTrue:[ |
2799 cmdPath := aCommandPath. |
2800 cmdPath := aCommandPath. |
2800 cmdLine := argString |
2801 cmdLine := argString |
2801 ] ifFalse:[ |
2802 ] ifFalse:[ |
2802 cmdPath := 'stxspawn.exe'. |
2803 cmdPath := 'stxspawn.exe'. |
2803 cmdLine := 'stxspawn.exe ' , aCommandPath , ' ' , argString |
2804 cmdLine := 'stxspawn.exe ' , aCommandPath , ' ' , argString |
2804 ]. |
2805 ]. |
2805 |
2806 |
2806 rslt := self |
2807 rslt := self |
2807 primExec:cmdPath |
2808 primExec:cmdPath |
2808 commandLine:cmdLine |
2809 commandLine:cmdLine |
2809 fileDescriptors:fdArray |
2810 fileDescriptors:fdArray |
2810 fork:doFork |
2811 fork:doFork |
2811 newPgrp:newPgrp |
2812 newPgrp:newPgrp |
2812 inPath:dirPath |
2813 inPath:dirPath |
2813 createFlags:nil. |
2814 createFlags:nil. |
2814 |
2815 |
2815 "/ 'created ' print. cmdLine print. ' -> ' print. rslt printCR. |
2816 "/ 'created ' print. cmdLine print. ' -> ' print. rslt printCR. |
2816 ^ rslt |
2817 ^ rslt |
2817 |
2818 |
2818 "Modified: / 31.1.1998 / 10:54:24 / md" |
2819 "Modified: / 31.1.1998 / 10:54:24 / md" |
4493 "this is a test method; |
4494 "this is a test method; |
4494 For testing double CTRL-C in blocking primitives" |
4495 For testing double CTRL-C in blocking primitives" |
4495 |
4496 |
4496 %{ |
4497 %{ |
4497 while(1) { |
4498 while(1) { |
4498 printf("b"); |
4499 printf("blocking..."); |
4499 Sleep(50); |
4500 Sleep(50); |
4500 } |
4501 } |
4501 %}. |
4502 %}. |
4502 " |
4503 " |
4503 OperatingSystem blockingTest |
4504 OperatingSystem blockingTest |
4505 " |
|
4506 ! |
|
4507 |
|
4508 blockingTest2 |
|
4509 "this is a test method; |
|
4510 For testing double CTRL-C in blocking primitives" |
|
4511 |
|
4512 %{ |
|
4513 while(1) { |
|
4514 printf("blocking..."); |
|
4515 STX_API_CALL1("Sleep", Sleep, 50); |
|
4516 } |
|
4517 %}. |
|
4518 " |
|
4519 OperatingSystem blockingTest2 |
|
4504 " |
4520 " |
4505 ! |
4521 ! |
4506 |
4522 |
4507 defaultSignal:signalNumber |
4523 defaultSignal:signalNumber |
4508 "revert to the default action on arrival of a (Unix-)signal. |
4524 "revert to the default action on arrival of a (Unix-)signal. |
4857 |
4873 |
4858 %{ /* NOCONTEXT */ |
4874 %{ /* NOCONTEXT */ |
4859 extern void __win32SetTimer(); |
4875 extern void __win32SetTimer(); |
4860 |
4876 |
4861 if (__isSmallInteger(milliSeconds)) { |
4877 if (__isSmallInteger(milliSeconds)) { |
4862 int millis; |
4878 __win32SetTimer( __intVal(milliSeconds) ); |
4863 millis = __intVal(milliSeconds); |
|
4864 __win32SetTimer(millis); |
|
4865 RETURN (true); |
4879 RETURN (true); |
4866 } |
4880 } |
4867 %}. |
4881 %}. |
4868 ^ false |
4882 ^ false |
4869 ! |
4883 ! |
5234 ! |
5248 ! |
5235 |
5249 |
5236 getLanguage |
5250 getLanguage |
5237 "return the domain this host is in. |
5251 "return the domain this host is in. |
5238 Notice: |
5252 Notice: |
5239 not all systems support this; on some, 'unknown' is returned." |
5253 not all systems support this; on some, 'unknown' is returned." |
5240 |
5254 |
5241 |name| |
5255 |name| |
5242 |
5256 |
5243 name := self getEnvironment:'LANG'. |
5257 name := self getEnvironment:'LANG'. |
5244 name isNil ifTrue:[ |
5258 name isNil ifTrue:[ |
5245 "/ ok, search the registry ... |
5259 "/ ok, search the registry ... |
5246 "/ under XP, it is found there ... |
5260 "/ under XP, it is found there ... |
5247 name := RegistryEntry |
5261 name := RegistryEntry |
5248 stringValueFor:'sLanguage' |
5262 stringValueFor:'sLanguage' |
5249 atKey:'HKEY_CURRENT_USER\Control Panel\International'. |
5263 atKey:'HKEY_CURRENT_USER\Control Panel\International'. |
5250 name notNil ifTrue:[ |
5264 name notNil ifTrue:[ |
5251 name := self mapLanguage:name. |
5265 name := self mapLanguage:name. |
5252 ]. |
5266 ]. |
5253 ]. |
5267 ]. |
5254 ^ name |
5268 ^ name |
5255 |
5269 |
5256 " |
5270 " |
5257 OperatingSystem getLanguage |
5271 OperatingSystem getLanguage |
6428 since my windows system menu crashes so often |
6442 since my windows system menu crashes so often |
6429 (even CTRL-ALT-DEL does no longer function, but ST/X is still alive), |
6443 (even CTRL-ALT-DEL does no longer function, but ST/X is still alive), |
6430 I added this in order to be able to shutdown w95 cleanly" |
6444 I added this in order to be able to shutdown w95 cleanly" |
6431 |
6445 |
6432 confirmationMessageOrNil notNil ifTrue:[ |
6446 confirmationMessageOrNil notNil ifTrue:[ |
6433 (Dialog confirm:confirmationMessageOrNil) ifFalse:[ |
6447 (Dialog confirm:confirmationMessageOrNil) ifFalse:[ |
6434 ^ false |
6448 ^ false |
6435 ]. |
6449 ]. |
6436 ]. |
6450 ]. |
6437 %{ |
6451 %{ |
6438 int flag; |
6452 int flag; |
6439 |
6453 |
6440 if (how == @symbol(shutdown)) { |
6454 if (how == @symbol(shutdown)) { |
6441 flag = EWX_SHUTDOWN; |
6455 flag = EWX_SHUTDOWN; |
6442 } else if (how == @symbol(reboot)) { |
6456 } else if (how == @symbol(reboot)) { |
6443 flag = EWX_REBOOT; |
6457 flag = EWX_REBOOT; |
6444 } else if (how == @symbol(logoff)) { |
6458 } else if (how == @symbol(logoff)) { |
6445 flag = EWX_LOGOFF; |
6459 flag = EWX_LOGOFF; |
6446 } else if (how == @symbol(forceShutdown)) { |
6460 } else if (how == @symbol(forceShutdown)) { |
6447 flag = EWX_SHUTDOWN | EWX_FORCE; |
6461 flag = EWX_SHUTDOWN | EWX_FORCE; |
6448 } else if (how == @symbol(forceReboot)) { |
6462 } else if (how == @symbol(forceReboot)) { |
6449 flag = EWX_REBOOT | EWX_FORCE; |
6463 flag = EWX_REBOOT | EWX_FORCE; |
6450 } else if (how == @symbol(forceLogoff)) { |
6464 } else if (how == @symbol(forceLogoff)) { |
6451 flag = EWX_LOGOFF | EWX_FORCE; |
6465 flag = EWX_LOGOFF | EWX_FORCE; |
6452 } else { |
6466 } else { |
6453 RETURN (false); |
6467 RETURN (false); |
6454 } |
6468 } |
6455 RETURN ((ExitWindowsEx(flag, 0) == TRUE) ? true : false); |
6469 RETURN ((ExitWindowsEx(flag, 0) == TRUE) ? true : false); |
6456 %} |
6470 %} |
6457 ! ! |
6471 ! ! |
6458 |
6472 |
8953 libraries... |
8967 libraries... |
8954 " |
8968 " |
8955 ! |
8969 ! |
8956 |
8970 |
8957 version |
8971 version |
8958 ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.144 2004-01-29 08:22:36 ca Exp $' |
8972 ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.145 2004-01-29 08:39:14 ca Exp $' |
8959 ! ! |
8973 ! ! |
8960 |
8974 |
8961 !Win32OperatingSystem::Win32FILEHandle methodsFor:'release'! |
8975 !Win32OperatingSystem::Win32FILEHandle methodsFor:'release'! |
8962 |
8976 |
8963 closeFile |
8977 closeFile |
8980 I represent a generic HANDLE, which can be closed via CloseHandle. |
8994 I represent a generic HANDLE, which can be closed via CloseHandle. |
8981 " |
8995 " |
8982 ! |
8996 ! |
8983 |
8997 |
8984 version |
8998 version |
8985 ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.144 2004-01-29 08:22:36 ca Exp $' |
8999 ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.145 2004-01-29 08:39:14 ca Exp $' |
8986 ! ! |
9000 ! ! |
8987 |
9001 |
8988 !Win32OperatingSystem::Win32Handle methodsFor:'io'! |
9002 !Win32OperatingSystem::Win32Handle methodsFor:'io'! |
8989 |
9003 |
8990 readBytes:count into:aByteBuffer startingAt:firstIndex |
9004 readBytes:count into:aByteBuffer startingAt:firstIndex |
9060 extPtr = extPtr + offs; |
9074 extPtr = extPtr + offs; |
9061 } |
9075 } |
9062 |
9076 |
9063 do { |
9077 do { |
9064 __threadErrno = 0; |
9078 __threadErrno = 0; |
9065 #ifndef DO_WRAP_CALLS |
9079 ok = STX_API_CALL5( "ReadFile", ReadFile, hFile, extPtr, cntWanted, &cntRead, 0 /* lpOverlapped */); |
9066 ok = ReadFile(hFile, extPtr, cntWanted, &cntRead, 0 /* lpOverlapped */); |
|
9067 #else |
|
9068 ok = __STX_API_CALL5( "ReadFile", ReadFile, hFile, extPtr, cntWanted, &cntRead, 0 /* lpOverlapped */); |
|
9069 #endif |
|
9070 } while(__threadErrno == EINTR); |
9080 } while(__threadErrno == EINTR); |
9071 |
9081 |
9072 if (ok == TRUE) { |
9082 if (ok == TRUE) { |
9073 if (! bufferIsExternalBytes) { |
9083 if (! bufferIsExternalBytes) { |
9074 /* copy over */ |
9084 /* copy over */ |
9307 extPtr = extPtr + offs; |
9317 extPtr = extPtr + offs; |
9308 } |
9318 } |
9309 |
9319 |
9310 do { |
9320 do { |
9311 __threadErrno = 0; |
9321 __threadErrno = 0; |
9312 #ifndef DO_WRAP_CALLS |
9322 ok = STX_API_CALL5( "WriteFile", WriteFile, hFile, extPtr, cntWanted, &cntWritten, 0 /* lpOverlapped */); |
9313 ok = WriteFile(hFile, extPtr, cntWanted, &cntWritten, 0 /* lpOverlapped */); |
|
9314 #else |
|
9315 ok = __STX_API_CALL5( "WriteFile", WriteFile, hFile, extPtr, cntWanted, &cntWritten, 0 /* lpOverlapped */); |
|
9316 #endif |
|
9317 } while(__threadErrno == EINTR); |
9323 } while(__threadErrno == EINTR); |
9318 |
9324 |
9319 if (ok == TRUE) { |
9325 if (ok == TRUE) { |
9320 if (mustFreeBuffer) { |
9326 if (mustFreeBuffer) { |
9321 free(extPtr); |
9327 free(extPtr); |
9367 ! ! |
9373 ! ! |
9368 |
9374 |
9369 !Win32OperatingSystem class methodsFor:'documentation'! |
9375 !Win32OperatingSystem class methodsFor:'documentation'! |
9370 |
9376 |
9371 version |
9377 version |
9372 ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.144 2004-01-29 08:22:36 ca Exp $' |
9378 ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.145 2004-01-29 08:39:14 ca Exp $' |
9373 ! ! |
9379 ! ! |
9374 |
9380 |
9375 Win32OperatingSystem initialize! |
9381 Win32OperatingSystem initialize! |
9376 Win32OperatingSystem::RegistryEntry initialize! |
9382 Win32OperatingSystem::RegistryEntry initialize! |