~ CHWINDOW.SAVhJ CHWINDOW.SAV`BACKUP CHWINDOW.COM,CHWINDOW.FOR,CHWINDOW.DOC,DPH$REBOOT.COM VMS:CHWINDOW.SAV/SAVE/GROUP=0/NOCRC TARRAGO_X @@: V4.6 _DECUSF::  _DECUSF$DUA0: V4.6 ~*[TARRAGO_X]CHWINDOW.COM;1+,ir. /@ 4I -0123KPWO 56G7 n8 @'p9G@HJC$ files_to_save="vaxvmssys.par/agen$addhistory.dat/modparams.dat"+-* "agen$feedback.dat/agen$feedback.report"1$!All this files are supposed to be in sys$system$ if f$mode().eqs."OTHER"$ then $ if .not.f$privilege("setprv")$ then$ call error DETACH_NOT_PRIV$ exit$ endif$$ if f$getsyi("window_system").eq.1$ then$ old_sys_settings="dec_"$ new_sys_settings="vws_"$ endif$$ if f$getsyi("window_system").eq.2$ then$ old_sys_settings="vws_"$ new_sys_settings="dec_"$ endif$ goto CHECK_OK$ endif$! Check accuracy$ error_status="NO_ERROR"$$ if f$trnlnm("sys$rem_node").nes.""$ then$ call error NO_LOCAL$ error_status="ERROR"$ endifA$ if f$getsyi("window_system").eq.1 ! Current UIMS is Decwindows$ then?$ if f$search("sys$specific:[sysexe]vws_vaxvmssys.par").eqs.""$ then$ call error NO_VWS_SETTING$ error_status="ERROR"$ else$ old_sys_settings="dec_"$ new_sys_settings="vws_"$ endif$ endif:$ if f$getsyi("window_system").eq.2 ! Current UIMS is VWS$ then?$ if f$search("sys$specific:[sysexe]dec_vaxvmssys.par").eqs.""$ then$ call error NO_DEC_SETTING$ error_status="ERROR"$ else$ old_sys_settings="vws_"$ new_sys_settings="dec_"$ endif$ endif)$ if f$getsyi("window_system").ne.1.and.-: f$getsyi("window_system").ne.2! Current UIMS is neither $ ! decwindow nor VWS$ then$ call error NO_WIN_SYS$ error_status="ERROR"$ endif'$ if error_status.eqs."ERROR" then exit$! Ask for confirmation2$ if f$mode().nes."INTERACTIVE" then goto CHECK_OK$ write sys$output -< " Vous avez demande un changement du systeme de fenetrage"$ write sys$output - " La station va rebooter." $ rep="O"B$ read/prompt=" Confirmation de la commande [O]?>" sys$command rep.$ if f$locate(f$extract(0,1,rep),"OoYy").eqs.4$ then$ call error USER_ABORT$ exit$ endif$ call error SUCCESS $CHECK_OK:$ if f$privilege("setprv")$ then$ gosub save_sys_settings$ gosub restore_sys_settings$ @sys$manager:dph$reboot$ else$ run chwindow_root:chwindow$ endif$ exit$SAVE_SYS_SETTINGS:$ i=0$SAVE_LOOP1_BEGIN:%$ file=f$element(i,"/",files_to_save)*$ if file.eqs."/" then goto save_loop1_endI$ if f$search("sys$specific:[sysexe]''old_sys_settings'''file'").nes."" - then delete/noconfirm/log -1 sys$specific:[sysexe]'old_sys_settings''file';*4$ if f$search("sys$specific:[sysexe]''file'").nes.""$ then+$ copy/log sys$specific:[sysexe]'file';* -2 sys$specific:[sysexe]'old_sys_settings''file';*$ else$ write sys$output -: "CHW-W-SAVEFAIL sys$specific:[sysexe]''file' not found"$ endif $ i=i+1$ goto save_loop1_begin$SAVE_LOOP1_END:$ return$RESTORE_SYS_SETTINGS:$ i=0$RESTORE_LOOP1_BEGIN:%$ file=f$element(i,"/",files_to_save)-$ if file.eqs."/" then goto restore_loop1_end4$ if f$search("sys$specific:[sysexe]''file'").nes.""$ then($ purge/log sys$specific:[sysexe]'file'-$ rename sys$specific:[sysexe]'file' *;32767$ endifG$ if f$search("sys$specific:[sysexe]''new_sys_settings'''file'").nes.""$ then=$ copy/log sys$specific:[sysexe]'new_sys_settings''file';* - sys$specific:[sysexe]'file';*$ else$ write sys$output -< "CHW-W-RESTFAIL sys$specific:[sysexe]''file' not restored"$ endifA$ if f$search("sys$specific:[sysexe]''file';32767").nes."" then -4 delete/noconfirm sys$specific:[sysexe]'file';32767 $ i=i+1$ goto restore_loop1_begin$RESTORE_LOOP1_END:$ return$ERROR: subroutine goto 'p1'$DETACH_NOT_PRIV:$ write sys$output -? "CHW-F-NOPRIV Detached process have not necessary privileges"$ exit $NO_LOCAL:$ write sys$output -; "CHW-F-NOLOC Invalid attempt to shutdown a remote system" exit$NO_VWS_SETTING:C$ write sys$output "CHW-E-NOVWSSET No vwsvmssys.par file available"$ exit$NO_DEC_SETTING:C$ write sys$output "CHW-E-NODECSET No decvmssys.par file available"$ exit $NO_WIN_SYS:$ write sys$output -= "CHW-E-NOSYSWIN Current UIMS is neither VWS nor Decwindows"$ exit $USER_ABORT:$ write sys$output -2 "CHW-I-ABORT Procedure canceled on user request"$ exit $SUCCESS:$ write sys$output -: "CHW-S-CHSTART Workstation will shutdown to switch UIMS"$ exit$endsubroutine*[TARRAGO_X]CHWINDOW.FOR;1+,./@ 4?V-0123KPWO56 CA7P8 'p9G@HJ PROGRAM STH IMPLICIT NONE INCLUDE '($LNMDEF)' INCLUDE '($PRCDEF)' INCLUDE '($PRVDEF)'0 CHARACTER*80 TITRE , DEVNAM, COMM_STR/' '/- INTEGER T_LEN, DEVLEN, STATUS, FLAGS/1/4 INTEGER LIB$GET_SYMBOL, SYS$CREPRC, SYS$CREMBX INTEGER*4 MASK, STH_CHAN integer*4 prvmask(2)C& MASK=PRC$M_DETACH.or.prc$m_nouaf prvmask(1)=prv$m_setprv prvmask(2)='40'X2 STATUS= SYS$CREPRC( ,'SYS$SYSTEM:LOGINOUT', 7 + 'CHWINDOW_ROOT:CHWINDOW.COM',? + 'sys$manager:chwindow.log',,prvmask,,* + 'Change_window',/ + %VAL(4),%VAL(65540),,% + %VAL(MASK)) IF(.NOT.STATUS) THEN& CALL LIB$SIGNAL(%VAL(STATUS)) END IF STOP END *[TARRAGO_X]CHWINDOW.DOC;1+,u ./@ 4O8-0123KPWO56`E7`~8p'p9G@HJ Install:& Editer chwindow.com et chwindow.forO Remplacer chwindow_root par la specif adequate ( dir ou se trouve$ ces deux fichiers)< Ou definir un logical chwindow_root pointant vers ce dir.. Compiler/linker chwindow.for (link/notrace)/ Installer chwindow.exe avec detach et setprv------J Si le process qui execute chwindow.com n'est pas privilegie, on executeFchwindow.exe qui cree un process correctement privilegie qui reexecute chwindow.comK Ce brico n'est pas garanti ni tres propre, mais ca peut donner des idees------E On suppose qu'il existe dans sys$manager un fichier qui s'appelle Ndph$reboot.com et qui reboot la machine. Je l'ai mis sous forme de fichier carLje m'en serts par ailleurs. Evidemment, on peut l'integrer dans chwindow.com*[TARRAGO_X]DPH$REBOOT.COM;1+,!U./@ 4;f-0123KPWO56Z87vM8'p9G@HJ$ set audit/alarm/disable=all;$ @sys$system:shutdown 0 reboot no yes yes yes reboot_check$ exit[